+ 1

help me figure it out, python

In the examples in the book, all code is written in the console > _. ... I do not have a console, I write code on an Android phone, and I only have an editor that does not run the code for the console. More than one code presented in the book does not work in this editor, tell me what to do, maybe I need to write the code differently? import math; math pi; Entering twice enter, and then everything works well for me, but if I write the same thing in an editor whose lines are already numbered like this: 1 import math; 2 math pi; launch, then I give the error is that I am writing the wrong syntax. Tell me what's the matter? in my book from which I study all examples are given and written in the consolebut I don't have a console but only a code editor and this code doesn't work on it at all. Please explain to me what is the problem?

7th Nov 2020, 12:28 AM
<AlexID>
<AlexID> - avatar
4 odpowiedzi
+ 1
This is what you write in the terminal: >>> import math >>> math.pi 3.141592653589793 To do the same thing in an editor: import math print(math.pi) When running it, it will print 3.14..... back to the terminal... You should not manually type line number in Editor! Hope this helps...
7th Nov 2020, 1:48 AM
G B
G B - avatar
+ 1
please tell me, all examples of code are written in the books in the console version, should I write and learn the console version or the version of the code editor? which is better and more correct, in the future I want to become Junior Python is a developer, so it is important for me to be able to do everything, please tell me and help me
7th Nov 2020, 6:28 AM
<AlexID>
<AlexID> - avatar
+ 1
import 'math' print('math.pi')
7th Nov 2020, 6:34 AM
<AlexID>
<AlexID> - avatar
0
Auto installing libraries... --> python3 /tmp/upm545901130/bare-imports.py '<secret sauce>' Auto installation complete. + poetry run python3 -u main.py File "main.py", line 1 import ('math')print( ^ SyntaxError: invalid syntax
7th Nov 2020, 6:33 AM
<AlexID>
<AlexID> - avatar