Hi, guys. My name is Bonnie and I'm the teacher's assistant for this course. Your teacher is Alan (I'm sure you already know these things, haha.) We're glad you're here and we're looking forward to helping you guys prepare for this year's ACSL contests. Homework and lesson notes will be posted to this page soon after class and the solutions will be posted the night before the next class. You can reach Alan and I through email or Discord, whichever you prefer. We'll check both platforms often.
Alan: alanxiao211@gmail.com
Bonnie: bonnie.ma200@gmail.com, bonnie#7837 (Discord)
My contact information is also in my profile in case you need it.
Here's our Discord server link (it's a server for all the classes in LoL, you can reach Alan or I through the "python-acsl" channel) - https://discord.gg/s5e9ma34.
Nice to meet you all, or for some of you, welcome back :)
10 - 10:40 -> Intro Slides + Intro Survey 10:50-11:30 -> ideone.com, Hello World, PEMDAS in Python
Unfortunately, some students today may have missed the second class. In the future, every full class will consist of two sessions, both of which have their own links, just like today. We're sorry for the confusion. If anyone ever misses class in the future, and for those that missed some today, here is everything we did. These kinds of notes will be posted every week. Ask Alan and I for more help whenever you'd like.
IDEONE.COM SIGNUP This is an online IDE service that can save your work once you create an account. Follow the below details to create yours (the settings on the left are not important, but make sure the default programming language is "Python 3").
HELLO WORLD
The first line of code we've written in this course. If it's written correctly, it should return this in the console below:
Print statements print whatever is in the parenthesis to the "output" tab. You can print strings, variables, integers, etc. with this command. Anything you want. In this case, we have printed a string, evidenced by the "" quotes around the text. Other examples of print statements:
print(6 * 10) print([1, 2, 3]) print(10 / 2) --------------- ---------------- ---------------- 60 [1, 2, 3] 5.0 --> this decimal makes this value a float
**Note: / is the symbol for division. It will return a float value (i.e. 6/3 = 2.0, 10/4 = 2.5). To return an integer, a number with no decimals, use //, the short form for a built-in function called floor. This will return the quotient rounded down to the nearest whole number (i.e. 6/3 = 2, 10/4 = 2).
PEMDAS
Parenthesis: () Exponents: ** Multiplication: * Division: / -> returns float, // -> returns int Addition: + Subtraction: -
You can write equations in Python the same way as real life. You can shove a whole 50-term expression into a print statement and Python will evaluate it with PEMDAS to give you an answer. Try to maintain decimals throughout the entire process to ensure an accurate answer, and then round after all the operations are done if you need to return a formatted answer.
^ This example statement returns 8. (3 x 7 is 21, floored by 4 is 5, plus 3 is 8.)
No homework this week, guys. See you all next week. -Bonnie (and Alan)