- 1

Q. Anna is 18 years old

Can anybody tell me the code. It shows error in code

25th Nov 2022, 4:51 PM
MÙTËÈF ÃHMÄD
MÙTËÈF ÃHMÄD - avatar
8 Antworten
+ 5
#Don't put anything as argument to input function. compare your output with expected name = input() age = int( input() ) print( name + " is "+ str( age ) + " years old")
25th Nov 2022, 4:59 PM
Jayakrishna 🇮🇳
+ 3
Code is. name = input("Anna") age = input("18") print(name + " is " + age + " years old")
25th Nov 2022, 4:56 PM
MÙTËÈF ÃHMÄD
MÙTËÈF ÃHMÄD - avatar
+ 2
Share your code here by saving it playground.. That helps to find mistakes..
25th Nov 2022, 4:52 PM
Jayakrishna 🇮🇳
+ 1
Bro, if I tell you simplest method then it would be really funny. And it is, print("Anna is 18 years old") You can apply another method. However, it is little bit advanced for beginners. name = input("Enter the name: ") age = int(input(" Enter the age:")) print(name+"is"+age+"years old")
27th Nov 2022, 11:26 AM
Anonymous
Anonymous - avatar
0
Second line of your code write like this age = input() Don't pass anything
25th Nov 2022, 9:26 PM
Haji Abdirahim Ali
Haji Abdirahim Ali - avatar
0
Name = Anna Age = 18 print(Name,"is",Age,"years old")
26th Nov 2022, 4:57 PM
Benjamin mwanza
Benjamin mwanza - avatar
0
name = input() age = input() print(name + " is " + age + " years old")
14th Dec 2022, 4:39 PM
AL-HAMEEN ADELEKE
AL-HAMEEN ADELEKE - avatar
- 1
I would have used a formatted string literal as last line like this: print(f"{name} is {age} years old")
26th Nov 2022, 1:18 PM
Paul
Paul - avatar