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
2 ответов
+ 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))
+ 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]