# Day 7
# ___ __
# / __\__ _ __ / / ___ ___ _ __ ___
# / _\/ _ \| '__| / / / _ \ / _ \| '_ \/ __|
# / / | (_) | | / /__| (_) | (_) | |_) \__ \
# \/ \___/|_| \____/\___/ \___/| .__/|___/
# |_|
'''
# for loops
for i in range(1,11): # loops until i has become every number in range
print("number is", i)
# you can set the range as variable
start = 10
stop = 100
for i in range(start, stop):
print(i)
# add a third value in range for steps
for i in range(start, stop, 10): # moves by try:
print(i)
# exit a loop with break
for i in range(start, stop):
print(f"i={i}")
if i == 7:
print("we are at seven")
break
'''
# assignment time!
# part 1
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("1. give me a range. i'll loop it")
start = stop = 0
while start >= stop:
try:
start = int(input("give me the starting number: "))
stop = int(input("give me the stopping number: "))
if start >= stop:
print("they gotta be the start and end!")
except ValueError:
print("gotta be a number")
for i in range(start, stop+1):
print(i)
input("press anything for next question...")
#part 2
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("\n\n 2. ")
print("\u0332".join("^1 ^2 ^3")) # makes underlined table header
for i in range(1, 11):
print(i, "", i*i, "", i*i*i) # displays squares and cubes.
input("press anything for next number...")
# part 3
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("\n\n3. ")
for i in range(13, 1301, 13): # goes up by steps of 13
print(i)
input("press anything for next question...")
# part 4
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("\n\n4. the ultra greetter")
name = "pussyboy"
number = -1
while number <= -1:
try:
name = input("what's your name: ")
number = int(input("how many times do you want to be greeted: "))
if number <= 0:
print("i gotta greet at least once")
except ValueError:
print("you gotta give me a number for the amount of times")
for i in range(1, number+1):
print("hey pussyboy")
if name != "pussyboy": # we like to have fun here
pussyboy = input("wait. your name isnt pussyboy, is it? [y/n]: ")
if pussyboy == "y" or pussyboy == "yes":
print("yeah. i thought so")
elif pussyboy == "n" or pussyboy == "no":
pussyboy = input("are you sure? i could have sworn it was pussyboy [y/n]: ")
if pussyboy == "y" or pussyboy == "yes":
print("alright. here is your greeting then")
for i in range(1, number+1):
print("hey", name)
elif pussyboy == "n" or pussyboy == "no":
print("then what the hell are you talking about"):w