Get the num+text instead text | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Get the num+text instead text

Do not judge harshly, I am just starting to learn. This is example from the Task part. In code below result is: 25eat them yourself But mast be: eat them yourself Why 25 added to text? siblings = int(input(2)) popsicles = int(input(5)) #your code goes here s = siblings p = popsicles if s > p: q = "give away" print(q) else: w = "eat them yourself" print(w)

31st Oct 2021, 6:55 PM
Pavel Salyga
Pavel Salyga - avatar
5 Answers
+ 4
In line: int(input(2)), => 2 is displayed on the console.. Enything as argument to input() function is displayed on the output console. Like: name= input("Enter your neme:") Enter the name: (this displayed on console ,this is for user understanding purpose to know what is prompting...) And now console ask for an input : So that why 25 is displayed on console. Just use int(input () ) also if it is about ,code coach task ,then there just write code for what is asked for output.. (non of any extra chars, ...) and take care of case sensitivity....
31st Oct 2021, 7:01 PM
Jayakrishna 🇮🇳
+ 3
try this a=int(input("ohhh")) got it? the argument of the function input is printed to console. the input itself goes to the left side. siblings = int(input()) will do the job
31st Oct 2021, 6:58 PM
Oma Falk
Oma Falk - avatar
+ 3
Yes, now I get it. Result is correct. Thanks a lot for the help.
31st Oct 2021, 7:13 PM
Pavel Salyga
Pavel Salyga - avatar
+ 2
s = 2 q = 5 if s>q: print("give them away") else: print("eat them yourself") in this code as well you will get 'eat them yourself' as result
1st Nov 2021, 11:49 AM
Kunj Mandaviya
Kunj Mandaviya - avatar
0
Tnx
3rd Nov 2021, 1:09 AM
Pavel Salyga
Pavel Salyga - avatar