+ 2

Does it have a right to exist?

Please explain what’s wrong or why it can’t be? https://code.sololearn.com/cdj3gAjR6GzV/?ref=app

5th May 2022, 3:05 PM
Ivan Horlenko
12 Answers
+ 4
In python, for input you need to use = instead of := and in the print statement you have used name(input()). As it is taking input single time you need to provide all the inputs at the beginning. Then it won't throw any error. Attaching the modified code. https://code.sololearn.com/c511vWEvqVq9/?ref=app
5th May 2022, 3:15 PM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
5th May 2022, 6:13 PM
aewerdev
aewerdev - avatar
+ 2
Ivan Horlenko Yeah in IDLE it won't throw any error, because there you can be able to run the code line by line execution. But in this editor you have to provide input at the beginning that's why it's throwing an error.
5th May 2022, 3:21 PM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 2
Decode What error you found? Code is fine. It works well on valid inputs.. Abhi Varshini For just the info, there := is also works fine.. It is called walrus opearator. Used to assign in compound statements function statements. Using = instead of := in assignment in compound statement is error.. Ivan Horlenko Original also fine. But there is difference in output statements.. Do you making equalent code for original code? What is wrong you found?
5th May 2022, 3:40 PM
Jayakrishna 🇮🇳
+ 1
I added original solution to code. Please check again
5th May 2022, 3:14 PM
Ivan Horlenko
+ 1
When I use IDLE Shell there is no error, it works correct
5th May 2022, 3:19 PM
Ivan Horlenko
+ 1
Ivan Horlenko It is understood now..? Or not? Where if? Just clear your question.. 2 codes works fine. 1st ask 2nd input if age>=18 else it don't ask your name.. 2 code asks two inputs , you must enter. Check: Input samples: 1) 5 2) 22 abc
5th May 2022, 5:15 PM
Jayakrishna 🇮🇳
+ 1
hmm jayakrishna there was an error before, maybe its gone now...
5th May 2022, 5:38 PM
Decode
Decode - avatar
0
Code is fine.. What is your trouble with code?
5th May 2022, 3:08 PM
Jayakrishna 🇮🇳
0
jayakrishna theres an error
5th May 2022, 3:08 PM
Decode
Decode - avatar
0
I just trying to understand how it could work at bigger code or at least just logic of these 2 codes
5th May 2022, 5:02 PM
Ivan Horlenko
- 1
Ag
6th May 2022, 7:32 PM
Arpita Vishwakarma