Introduction
Terminal commands #
- List files in current directory
> ls
- List files in current directory (include hidden)
> ls -a
- Change into a subdirectory
> cd <directory_name>
- Move back to parent directory
> cd ..
- Show current directory's path
> pwd
Getting started #
- Install python: https://www.python.org/
- Try the REPL (read-eval-print loop) to run some statements interactively
> python3
Python 3.10.6...
>>> 2 + 2
4
- Install VS Code. Any plain-text editor will do, but some extra functionalities like syntax highlighting, etc.
Basics data types #
Type | Python name | Example |
---|---|---|
Integer | int | 3 |
Float | float | 3.14 |
String | str | "Hello" |
Boolean | bool | True (or False) |
Variables #
Values can be assigned to variables.
color = "Red"
# Change color
color = "Blue"
Basic functions #
print
: show output in the terminal
color = "Blue"
print(color)
input
: takes input from the terminal and assigns it to a variable
color = input("What's your favourite color: ")