I need help! | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

I need help!

Hi! I am just starting with python, now I am making a ‘Dog Age Calculator’. But just a little thing doesn’t work in the code, you wil see when you open the code. I hope someone can help me :) https://code.sololearn.com/cPCxsBollse0/?ref=app

1st Jun 2020, 10:21 PM
Thijmen
2 Respuestas
+ 3
You need to convert the input to a number(int) to multiply it then convert back to a string to add it to another string and print print("Dog Age Calculator!") age = input("Your dog his age in human age:\n") print("Entered age is " + age) dogage = int(age) * 7 print("Your dog his age is " + str(dogage))
1st Jun 2020, 10:26 PM
JME
+ 1
In a more concise form: print("Your dog age is", 7*int(input())) [using , in print() instead of + the conversion to string is automatic]
2nd Jun 2020, 7:07 AM
Bilbo Baggins
Bilbo Baggins - avatar