1
I’m doing an exercise in Python and I don’t understand why the output is coming back with None together, I thank you
def main(x,nomePlaneta) :
if nomePlaneta == "Terra" :
valordois = x//86400
valortres = (x%86400)//3600
valorquatro = ((x%86400)%3600)//60
valorcinco = ((x%86400)%3600)%60
elif nomePlaneta == "Jupiter":
valordois = x//35760
valortres = (x%35760)//3600
valorquatro = ((x%35760)%3600)//60
valorcinco = ((x%35760)%3600)%60
elif nomePlaneta == "Venus" :
valordois = x//20995200
valortres = (x% 20995200)// 3600
valorquatro = ((x% 20995200)% 3600)//60
valorcinco = ((x% 20995200)% 3600)%60
elif nomePlaneta == "Mercurio" :
valordois = x// 5068800
valortres = (x% 5068800)// 3600
valorquatro = ((x% 5068800)% 3600)//60
valorcinco = ((x% 5068800)% 3600)%60
print(x, 'segundos no planeta Terra equivalem a:')
print(valordois, 'dias,',valortres, 'horas,',valorquatro, 'minutos e',valorcinco ,'segundos')
lista = input().split()
valor1 = int(lista[0])
nomePlaneta = str(lista[1])
print(main(valor1,nomePlaneta))
Solved, had researched and found in some similar problems, that this happens when you call the function itself within the function. In case he was putting print inside print. To solve, I only modified the last print(main(value1,namePlaneta)) by main(value1,namePlaneta) and there it was correct
– Gabriel_86400