Calvin (Deutschbein)
W2Fri: 6 Sep
import karel
def main():
move() |
# no import
def main():
move() # this won't work |
What does Python do?
some_karel.py
import karel
def main():
move() |
hello.pyprint("Hello, World!") |
Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
C:\Users\cd-desk>python
Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hello world")
hello world
>>>
1234 * 5678 # its 7006652...
# but I would never be able to figure that out
2000 * 32 * 365
|
cal.py# CALvinORIES
print(2000 * 32 * 365) In the terminal... |
C:\Users\me>python Karel_Newspaper.py
C:\Users\cd-desk\Downloads\problem-set-1-karel-cd-public-main\problem-set-1-karel-cd-public-main
cd Downloads\problem-set-1-karel-cd-public-main\problem-set-1-karel-cd-public-main
C:\Users\cd-desk>cd Downloads\problem-set-1-karel-cd-public-main\problem-set-1-karel-cd-public-main
C:\Users\cd-desk\Downloads\problem-set-1-karel-cd-public-main\problem-set-1-karel-cd-public-main>
python Karel_Newspaper.py
C:\Users\cd-desk>cd Downloads\problem-set-1-karel-cd-public-main\problem-set-1-karel-cd-public-main
C:\Users\cd-desk\Downloads\problem-set-1-karel-cd-public-main\problem-set-1-karel-cd-public-main>python Karel_Newspaper.py
Home\Downloads\PS1zip\PS1folder
<variable name> = <numerical value>
variable_name = 7 # one of my fav numbers
In the terminal...
|
cal.py# CALvinORIES
calories_per_day = 2000
years = 32
days_per_year = 365
days = years * days_per_year
print(calories_per_day * days) In the terminal... |
Does it happen more than once? | |||
No | Yes (it's a loop) | ||
Is it conditional (do we ask Karel a question)? |
No |
|
|
Yes |
|
|