Lecture 1 Flashcards
What are the three ways for python to be used in this class
1) python, interactive shell, also called REPL
2) Running a python script
3) Jupyter notebook
In short, what is python interactive shell?
Execute Python code interactively line by line. Suitable for simple tasks, experimentation with syntax, checking how function works, or as a calculator. Code is not saved or reusable.
In short, what does running a python script do?
Run an entire file at once. Suitable for complete programs. Code is saved and reusable.
In short, what does Jupyter notebook do?
Run smaller sections of code one at a time. Integrated documentation/instrumentation to make the code more interactive and user-friendly. Great for teaching/learning and science applications.
How to open a new terminal in VS code
Select terminal then select new terminal.
How to make the terminal interact with python code?
Type the lowercase word Python into the terminal window and click enter. The terminal is now interactive. To close the terminal type exit().
How to open a python script
In vs code select file then new file in the pop-up window that appears select python file. Save the file by selecting file, then save as.
How to use a print function.
For a printed sentence type print(“words”)
What is the input command?
input(“prompt”)
Do white spaces or tabs impact python?
Yes, be careful. They will cause unexpected errors.
How does order impact Jupiter notebook?
Cells are running the order you specify which may not be from top to bottom. The order in which cells are executed is indicated by the number in the square bracket beside the code cell