0

Problem with python compiler

Hi guys! I'm a beginner with python, and I'm very confused with running my codes... I've already installed python on my laptop and run my code in "Python 3.9.0 shell" but the problem is that I get an error for running most of the programs. For example, for below code, it runs fine in "sololearn online compiler" but it shows an error in "Python 3.9.0 shell" x = 5 y = 10 print(x + y) Or sometimes vise versa! Below code runs fine in "Python 3.9.0 shell" whereas it gets an error in "sololearn online compiler" a=input('enter a: ');\ b=input('enter b: ');\ c=a+b;\ print('a+b equalls: ' + c) What's the problem??! Thanks for your help:)

11th Feb 2021, 3:15 PM
Reza Afsharian Zadeh
Reza Afsharian Zadeh - avatar
4 ответов
0
No, if you have the python Idle just click on file->new file Or just write your code in any text editor and save it as '.py'
12th Feb 2021, 8:57 AM
Angelo
Angelo - avatar
+ 6
The second code works fine on sololearn. Just you have to give input in multiple lines like that: 5 6 For the first code ,I will tell you to try again in your python compiler .
11th Feb 2021, 3:25 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
The problem is that you are using the shell! It can only take a line at a time (or a compound statement) The ';' is used to separate commands, while '\' to join lines So x=5 y=10 print(x+y) Are 3 different lines While the other is one You should really write files for programming, and using the shell only for interactive (one command at a time) things Sololearn makes you write files
12th Feb 2021, 4:30 AM
Angelo
Angelo - avatar
0
Thank you dear Angelo ! Should i install another software on my laptop to write my codes easilly like sololearn? If so, what's the best and known software for that?
12th Feb 2021, 8:47 AM
Reza Afsharian Zadeh
Reza Afsharian Zadeh - avatar