When I run this..It asks something...what to do?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

When I run this..It asks something...what to do??

https://code.sololearn.com/c25W5wzV2rJH/?ref=app

11th Dec 2018, 2:15 AM
K.Shyam Charan
K.Shyam Charan - avatar
4 Answers
+ 2
The input() function asks the user for an input. input('6') doesn't make much sense. You can use input("Enter first number"), or simply input(), as Sololearn doesn't display the prompt while taking inputs. Also, since inputs are treated as strings, it may be a good idea to convert it into an integer or a float, with something like num1=int(input()). Then in line 6, concatenation between a string and an int is not possible, so you'd have to do print('The answer is ' + str(num1+num2)) Or simply (note the comma) print('The answer is ', num1+num2) That's all about the code. Now you have to understand how input on Sololearn works. Here we have to input everything in the pop up box right after we hit run. We put each new input in new lines. Here it could be something like 12 43 add Then we press Submit, and that's when the code is executed and the output is shown. Does that make sense? Let me know 😊
11th Dec 2018, 2:31 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 1
Yes, we have to input all the stuff at the beginning on Sololearn and some other online interpreters. But if you run it on Python installed in your computer, it should work fine.
11th Dec 2018, 1:14 PM
Kishalaya Saha
Kishalaya Saha - avatar
0
Thanks
11th Dec 2018, 1:01 PM
K.Shyam Charan
K.Shyam Charan - avatar
0
Is this only for sololearn??
11th Dec 2018, 1:01 PM
K.Shyam Charan
K.Shyam Charan - avatar