+ 1
About a code
Input Name:Anna Age:18 Name:Dan Age:21 name=input () age=input () print(name+"is" + age+ "years old") Expected: Test case#1 Anna is 18 years old Test case#2 Dan is 21 years old
10 odpowiedzi
+ 8
Muhammad Jonaeed Hossain ,
it is more convenient to use the notation with commas. no extra spaces are needed:
...
print(name, "is", age, "years old.")
+ 5
Muhammad Jonaeed Hossain ,
if the dot '.' is not required, just remove it:
...
print(name, "is", age, "years old")
if you still have trouble, you should copy / paste the original task description here.
> is this an exercise from sololearn or is it from an other learning platform?
+ 5
Muhammad Jonaeed Hossain ,
sorry to say - but this code is a desaster. i am sure that you have not started learning python at all. without basic knowledge in python you will fail in this case, and probably also in any upcoming cases.
it is recommended to learn from the *python for beginners* tutorial. after finished this tutorial, give a again a try.
+ 3
you are missing spaces and the last dot in your strings
print(name + " is " + age + " years old.")
I hope this helps :)
+ 2
I have done the first Test case.
But I'm failed to solve the another.
0
But there is no dot in this code
0
Help me to solve this code
0
name =input()
age =input()
print("Anna" + " is " + "18" + " years old")
name =()
age=()
print("Dan" + "is" + "21" + "years old")
expected output:
Anna is 18 years old
Dan is 21 years old
0
name = input()
age = input()
print(str(name) + " is " + str(age) + " years old")
- 2
I want solution of this CODE