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 :)
Two/Three Examples for Each Data Type:
a. Strings: Hello, hEllo, heLlo
b. Integers: 3, 1, 4
c. Float: 3.14, 2.71, 9.99
d. Booleans: True, False
Story:
name = input("Hello there, human being. What is your name?: ")
age=input("Nice to meet you," + name + ". How old are you?: ")
if int(age)>=0:
print(f'You are {age} years old.')
color=input("What's your favorite color, " + name + "?: ")
time=input("What time is it?: ")
adjective1=input("Enter any adjective: ")
adjective2=input("Enter a second adjective: ")
noun1=input("Enter any noun: ")
noun2=input("Enter a second noun: ")
print("Okay, here's a random story that will probably not make sense.")
start=input("Are you ready (yes/no): ")
if "yes":
print(f'At {time}, {name} became {adjective1} when they saw {noun1}.')
next=input("Do you want to know what happens next? (Yes/No): ")
if "Yes":
print(f'One second later, {name} turned into a {adjective2} {noun2} and died. Goodbye.')
elif "No":
print("Goodbye.")
else:
print(f'Goodbye, {name}.')
elif "no":
print("Goodbye.")
else:
print("I don't understand.")
else:
print(f'You are not {age} years old. Goodbye.')