# Intro to Python
## Week 1 Review
## ``type``s, `print`, `input`
### [Prof. Lane](#links)
#### Virtual Office Hours 10AM & 7PM: #### [sdccd-edu.zoom.us/my/dlane](https://sdccd-edu.zoom.us/my/dlane) --- ## Attendance
When I call your name, raise your hand and... - Name a type or function - Explain what it does
If we run out of types or functions, tell us something you learned last week. note: - [officefile:///home/hobs/code/mesa_python/mesa_python/data/private-fall26/runestone_roster_fall26.ods](officefile:///home/hobs/code/mesa_python/mesa_python/data/private-fall26/runestone_roster_fall26.ods) - How do you convert from one type to another? - What is active learning? --- ## Challenge ## Create an integer variable note: - How many different ways can you think of? --- ```python num_sides = 4 ``` note: - What character do you use for a separator in Python numbers --- ```python num_bytes = 4_000_000_000 ``` note: - translate that number into natural language? - what is that number in natural language? - 4 million? - how much RAM would you need to hold that many bytes? --- ## 4GB in scientific notation? --- ```python num_bytes = 4 * 1e9 num_bytes = 4 * 1e9 num_bytes = int(4 * 1e9) ``` --- ```python num_bytes = int(4 * 1e9) ``` note: - translate that number into natural language? --- - Do a math operation (addition, subtraction, multiplication, division) - Create `str`, `int`, and `float` variables - Data types and how to convert between types - Send and receive standard text input and output - `print()` - `input()` - Active learning - Run a python program in the terminal (Git-Bash) --- ## You - What do you want to do with Python? --- ## What is bash? --- - Every computer has a text "command line" interface like bash - A terminal (or shell) is your window into a computer's brain - In Bash you can type commands to manipulate files and directories - Bash is the best way to explore and get to know your computer --- ## Bash as a text adventure! - cd: choose door - ls: looksee - pwd: print where them dam I am - mkdir: make "door" note: - Sowershell is crap (literally enshittified) --- ## Can you add strings? --- ```python >>> print('hello', 'world') ``` --- ```python >>> print('hello' + 'world') ``` --- ```python >>> print('Hello ' * 3.0) ``` --- ```python >>> print('Hello ' ** 3) ``` --- ```python >>> print('Hello ' * '3') ``` --- ## What does this do? ```python >>> str.upper('yelling') ``` --- ## Explore `str.`[TAB] --- ``` or ```python >>> str.upper('YELLING') ``` or ```python >>> print('Hello '.lower()) ``` or ```python >>> print('Hello '.lower()) ``` ## Help me teach After you've played a few gameshell games tell me some ways to teach - ``find`` - ``grep`` - ``cat`` - ``less``/``more`` - ``nano`` --- ## GameShell [bash.proai.org](https://bash.proai.org/) ^[github.com/hobson/GameShell-Browser](github.com/hobson/GameShell-Browser)^ note: Let's take a break and see how you do on your own. You're first intro to forward and backslashes will be to type that URL in your browser.