RESOURCES: Class slides: https://docs.google.com/presentation/d/1zIPSvXFg7eEVjguovCNHKpuojvqCq6eA5tjJpfGnSKc/edit?usp=sharing
Coding platform: replit.com
Discord: https://discord.gg/FKKAcmrr
HOMEWORK:
Give 3 examples of each data type (2 examples for Booleans).
Take user input and tell an interactive story using f-strings and concatenation of variables and print statements.
Example of a starting point:
username = input(“What is your name?”)
print(username + “, you know my name, not my story”)
Post your answers as a comment! Solutions will be posted later.
Feel free to email shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) if you're stuck or have questions! See you next class :)
#strings: "food", "cat", "bell pepper" #integers: 3, 4, 12 #floats: 0.5, 0.23, 4.56 #booleans: true, false username = input("What is your name? ") print(username + ", you know my name, not my story.") print("one day, as I was walking to the store, I found that there was a ravine formed by a recent earthquake. There were three bridges spanning the chasm. A sign said to use the first bridge, but the bridges were not labeled. Should I choose the left, middle or right bridge?") bridgeChoice = input("Which bridge did I choose? ") print("I chose the "+bridgeChoice+" bridge. Thankfully, it was safe and I soon got to the store. At the store, I bought many things.") item = input("one thing I bought was a ") adj = input("however, it was a "+item+" that looked ") print("after that, I went home with my "+adj+" "+item+".")
ReplyForward