+ 4
Output from Sololearn and Python3
I often write code in some text editor and execute using python3 using terminal. When I use same code in sololearn, there is an irregular display of output. How I can overcome this?
5 Answers
+ 3
Sure
a=input( "Hey, Do you want to check whether a number is odd or even? Enter the number ")
if not (a.isdigit()):
print("No. The input is not an integer")
elif int(a)%2==0:
print("The number is even"?
elif int(a)%2==1:
print("The number is odd")
If this code run in Sololearn, entire text comes at a time instead one after the other.
+ 2
Can you explain more on irregular display of output. Maybe a example of code that creates this problem.
+ 2
i think so it is about pop up version of input interface within sololearn. It has not same flexibility with python text editors. if we write any comment inside the input (like, âHey,Do you....odd or even?) output returns instantly with this comment; so we can give info by #comment to avoid writing inside the (ââ) input for sololearn interface. It is my solution :)
+ 1
I think commenting would be a better alternative.
Thank you Oguz and Adam.
0
Because solo learn is a app. The creators came up with a weird way of getting inputs from languages like python. It seems that solo learn checks the code for a input and asks for a input prior to running the code.
In my opinion I think the app shines with web development. You can clearly see this because most popular programs are in html, css, and js because it is the only way to show visual graphics and input, but I digress.
There is no perfect way to get input through the app. The alternated way suggested is to write a long comment at the top detailed what to input. Then the user reads the comment and runs the program and knows what to type for an input.
Ex.
# Input a number to see if it is even or #odd.
# created by: blah blah
a=input( "Hey, Do you want to check whether a number is odd or even? Enter the number ")
if not (a.isdigit()):
print("No. The input is not an integer")
elif int(a)%2==0:
print("The number is even"?
elif int(a)%2==1:
print("The number is odd")