Lesson #2-1: Functions
Watch Video 2-1: Functions
Access www.codeskulptor.org
Write and Save a Functions.py file
http://www.codeskulptor.org/#examples-functions.py
When creating a function, what does def do? What does return do?
What happens if you forget your colon?
What happens if the indentation is wrong?
In your triangle_area function, what happens if you don't use return?
What shortcut did he use when calculating the Kelvin conversions?
Lesson #2-2: More Operations
Watch Video 2-2: More Operations
Access www.codeskulptor.org
Write and Save a More_Operations.py file
http://www.codeskulptor.org/#examples-more_operations.py
What does 28 % 24 equal to? Why?
Why do programmers like the 24 hour clock over the 12 hour clock?
Why is 20 + 8 % 24 not equal to (20 + 8) % 24?
How is using modular arithmetic useful in making games?
How can you convert 3am to 03:00, without all those annoying spaces?
How do you import modules?
What does random.randrange(0,10,2) do?
Lesson #2-3: Logic and Comparisons
Watch Video 2-3: Logic and Comparisons
Access www.codeskulptor.org
Write and Save a Logic_and_Comparisons.py file
If a is true, and b is false, what is the value of (a and b)? (a or b)?
Make a truth table for (a and b) or (c and (not d))
Lesson #2-4: Conditionals
Watch Video 2-4: Conditionals
Access www.codeskulptor.org
Write and Save a Conditionals.py file
http://www.codeskulptor.org/#examples-conditionals.py
What is the difference between if, elif, and else?
TASK: Write a program testing if a year is a leap year.
Can you figure out past, present, future years?
Lesson #2-5: Programming Tips Week #1
Watch Video 2-5: Programming Tips
Access www.codeskulptor.org
Fix the following errors:
1) http://www.codeskulptor.org/#user2-zLIkOAkpwOkEZGb.py
2) http://www.codeskulptor.org/#user2-zPoDOXq2ED5coPt.py
3) http://www.codeskulptor.org/#user2-duHILwP4p4WKApO.py
4) http://www.codeskulptor.org/#user2-LzuufTEQIyokFE3.py
5) http://www.codeskulptor.org/#user2-mHB2R1YT3tcMOZC.py
6) http://www.codeskulptor.org/#user2-Ysk6EoRFWOTksFJ.py
7) http://www.codeskulptor.org/#user2-jCBswsrb4i0r8va.py
Make the following more readable:
8) http://www.codeskulptor.org/#user2-lKZItVERVBbkpq8.py
Answer: http://www.codeskulptor.org/#user2-gz1pkUdMvdtGZLD.py
What is the difference between """comment""" and #comment?