print("hello") x=input(" what is your name ") y=(len(x)) z=input(" what is your age ") s=str(y+z) print(s) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

print("hello") x=input(" what is your name ") y=(len(x)) z=input(" what is your age ") s=str(y+z) print(s)

this program give me error.. I don't find problem.. any Methmetics is not happening in this program..

2nd Jul 2018, 7:12 AM
Sanket Patel
2 Answers
+ 5
by default input() return a string so z is already of string type two solution to your problem #first: z = int ( input(" what is your age")) s = str(y+ z) ''' this will add length to the age and then convert it to the string, addition of numbers''' #second: s = str(y) + z ''' in this z will remain in string type, we just have to convert y, this will result in length of name followed by the age, append two string''' Edit: as your question doesn't clarify what do you want to do? gave you both the solution, choose according to your need.
2nd Jul 2018, 7:17 AM
Nikhil Dhama
Nikhil Dhama - avatar
+ 2
Please post a topic like "Help with code please" and then put all the details within the question.
2nd Jul 2018, 9:00 AM
Duncan
Duncan - avatar