+ 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

16th Nov 2022, 7:44 PM
Muhammad Jonaeed Hossain
Muhammad Jonaeed Hossain - avatar
10 Respuestas
+ 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.")
16th Nov 2022, 8:15 PM
Lothar
Lothar - avatar
+ 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?
17th Nov 2022, 7:19 AM
Lothar
Lothar - avatar
+ 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.
17th Nov 2022, 1:31 PM
Lothar
Lothar - avatar
+ 3
you are missing spaces and the last dot in your strings print(name + " is " + age + " years old.") I hope this helps :)
16th Nov 2022, 8:07 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 2
I have done the first Test case. But I'm failed to solve the another.
16th Nov 2022, 8:18 PM
Muhammad Jonaeed Hossain
Muhammad Jonaeed Hossain - avatar
0
But there is no dot in this code
16th Nov 2022, 8:16 PM
Muhammad Jonaeed Hossain
Muhammad Jonaeed Hossain - avatar
0
Help me to solve this code
16th Nov 2022, 8:38 PM
Muhammad Jonaeed Hossain
Muhammad Jonaeed Hossain - avatar
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
17th Nov 2022, 7:48 AM
Muhammad Jonaeed Hossain
Muhammad Jonaeed Hossain - avatar
0
name = input() age = input() print(str(name) + " is " + str(age) + " years old")
6th Oct 2023, 9:15 PM
Rinat Piakshev
Rinat Piakshev - avatar
- 2
I want solution of this CODE
17th Nov 2022, 7:48 AM
Muhammad Jonaeed Hossain
Muhammad Jonaeed Hossain - avatar