I'm stuck on a question this is python beginner course | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'm stuck on a question this is python beginner course

You’re making a contact management system. The given program declares two variables, name and age. Complete the code to output "name is age years old", where name and age are the declared variable values.

10th Mar 2021, 11:40 AM
Kangmin Heo
Kangmin Heo - avatar
23 Answers
+ 6
Is there anything wrong with adding the spaces inside of the single quotes? The result is correct, but is this a bad way to practice it? name = "James" age = "42" print (name + ' is ' + age + ' years old ')
18th Aug 2021, 6:08 PM
Brandon Peoples
Brandon Peoples - avatar
+ 4
Finally I make it..... auuuhhhh print(name, "is", age, "years old") Wish u luck!!
22nd Sep 2021, 11:47 AM
Mohammed Yassine Flimine
+ 2
name = "James" age = "42" print(f'{name} is {age} years old')
20th Sep 2021, 6:01 AM
Anwesha Mishra
Anwesha Mishra - avatar
+ 1
me too, i am also stuck on this question as I have done so many ways but the output does not show space between words..I have tried in many ways such as: Name = "James" Age = "42" print(name + "is" + age + "years old") the output become nameisageyears old 😅... does anyone help me to pointing which code or bug I have made mistake. Thank you.
22nd Apr 2021, 11:07 AM
DANIEL
DANIEL - avatar
+ 1
name, age = "James", "42" print(f"{name} is {age} years old")
24th May 2022, 3:59 PM
Mazitov Radmir
Mazitov Radmir - avatar
+ 1
name="James" age="42" print("name=James,age=42")
30th Jul 2022, 12:54 PM
Ishika Jaiswal
Ishika Jaiswal - avatar
0
name = "James" age = "42" print("name" is "age" years old)
10th Mar 2021, 11:46 AM
Kangmin Heo
Kangmin Heo - avatar
0
print(name + “ is ” + age + “ years old”) Remeber the spaces
10th Mar 2021, 11:48 AM
Sharique Khan
Sharique Khan - avatar
0
Thanks
10th Mar 2021, 11:55 AM
Kangmin Heo
Kangmin Heo - avatar
0
name = "James" age = "42" print (name+' is '+age+' years old ')
24th Apr 2021, 10:49 AM
Garima Nishad
Garima Nishad - avatar
0
Have you find solution i’m also stuck on it
9th May 2021, 9:41 AM
Sara_889
Sara_889 - avatar
0
name = input("James") age = int("42") print(name + "is", age, "years old")
15th May 2021, 4:08 AM
Miyuru Bhashitha Amarasiri
Miyuru Bhashitha Amarasiri - avatar
0
name="vamshikrishna" age="18" print(name +"is" + age + "years old")
17th May 2021, 12:34 PM
Vamshikrishna chowhan
Vamshikrishna chowhan - avatar
0
name = input("Name: ") age = input("Age: ") print(f"{name} is {age} years old")
15th Jun 2021, 1:17 PM
Lohit Patil
Lohit Patil - avatar
0
Hello DANIEL. Keep in mind that Age and age are two different variables, the same goes for Name and name. And for the other problem you can just put a space after is (before ending the string) and before years old (this time after the first quotation). So it would look something like this: name='arvin' age='100' print(name + ' is ' + age + ' years old')
10th Jul 2021, 9:39 AM
Arvin
0
name = input("James") age = int("42") print(name + "is", age, "years old")
22nd Aug 2021, 4:44 PM
Vraj Soni
Vraj Soni - avatar
0
The answer is Print(name,’is’,age,’years old’)
25th Aug 2021, 1:06 AM
Mister Teck
Mister Teck - avatar
0
print(name + 'is' + age + 'years old ')
27th Aug 2021, 11:34 AM
PRINCE KUMAR
PRINCE KUMAR - avatar
0
name = "James" age = "42" print(" " + name + " is "+ age +" years old")
7th Dec 2021, 3:26 AM
Siti Farahin Abdul Samad
Siti Farahin Abdul Samad - avatar
0
print (name + " "+"is" + " "+ age +" "+ "years old")
1st Mar 2023, 10:22 PM
المهندس أحمد
المهندس أحمد - avatar