Hi everyone, hope you had a great first class!
RESOURCES:
Class slides: https://docs.google.com/presentation/d/1QYxtxPQ2aYn4e7HWUbLPgZIO43LFtU6Tu8G8GVM7BlE/edit?usp=sharing
Example code: https://replit.com/@ShravyaS/IntroToPython
Coding platform: replit.com
Join the Discord (if you can): https://discord.gg/Am6Y3r2y
(You can always ask for help under #intro-python)
In addition, here's a quick recap:
- Python is a programming language that's readable and user-friendly.
- In repl.it, the left side is the editor and the right side is the console. Code goes in the editor, output in the console.
- Variables are like a box that contain values.
- Datatypes are types of values, and they include strings, ints, floats, booleans, and more.
- Strings = chain of characters (ex: "Hello!")
- Integers = numbers (ex: 9)
- Floats = decimals (ex: 2.5) - Boolean = True or False
- Variables can be created, reassigned, or printed (with other values, too.)
HOMEWORK:
1. Give 3 examples each (different from the slides) of integers, floats, and strings. (9 in total.)
2. Write a program that stores 2 variables: a title (like "Sir" or "Mr.") and a name. What data type is best to use for these two variables? Have the program print out "Hello, {title} {name}"
Post your answers as a comment! We'll post solutions before next class.
Ints: 7, 1000000, and 15. Floats: 12.756, 0.1, and 10.981. Strings: "I'm hungry", "Tomato's", and "Cats are cool".
title = "Ms."
name = "person"
print("hello", title, name)