# Day 6
#   __    __ _     _ _          __                         ____
#  / / /\ \ \ |__ (_) | ___    / /  ___   ___  _ __  ___  |___ \
#  \ \/  \/ / '_ \| | |/ _ \  / /  / _ \ / _ \| '_ \/ __|   __) |
#   \  /\  /| | | | | |  __/ / /__| (_) | (_) | |_) \__ \  / __/
#    \/  \/ |_| |_|_|_|\___| \____/\___/ \___/| .__/|___/ |_____|
#                                             |_|

# make a random number
# bring in the random module
import random
# random.randit(1, 10)
# generares an interger between 1 and 10

# Part one
# A)

print("1.")
print("   a) this will print all multiples of four between -444 and 448")
input("   press enter to print them...")

fourhundred = -444                                 # set number to minimum

while fourhundred >= -444 and fourhundred <= 444:  # "loop until number is maximum" | written this way to include max and min
    print(fourhundred)
    fourhundred+=4

print("done!")

# B)
#.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.

print("\n  b) this will print all numbers from 10000 to 0 in steps of 5")
input("  press enter to print them all...")

onethousand = 1000

while onethousand >= 0 and onethousand <= 1000:
    print(onethousand)
    onethousand-=5

print("done!")

# C)
#.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.

p   rint("\n  c) this will create a simple sequance")
input("  press enter to print them all...")

seqstart = 1
seqadd = 2

while seqstart >= 1 and seqstart <= 78:
    print(seqstart)
    seqstart = seqstart + seqadd
    seqadd+=1 # change the amount added to match sequance

print("done!")

# Part 2
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_

print("\n\n2. create a sequance and calculate its sum")

binaryseq = 1    # track bottom number
binarysum = 0    # track sum

while binaryseq >= 1 and binaryseq <= 1028:
    print(1/binaryseq, " or 1 /", binaryseq)
    binaryseq = binaryseq*2                       # make next bottom number
    binarysum = binarysum + 1/binaryseq           # add new number to sum

print("the sum of all the numbers is", binarysum)
input("press enter for next question...")

# Part 3
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_

print("\n\n3. brute force an equation (3x^2 - x = 1564)")

x = y = 0         # define both variables

while y != 1564:
    y = 3*x*x-x   # plug new x into equation
    x+=1          # change x

print("the x value is", x-1)
input("press enter for next question...")

# Part 4
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_

print("\n\n4. simulate a bunch of dice rolls")

totalrolls = dice = 0 # define variable

while dice != 48:
    dice = random.randint(1, 6) + random.randint(1, 6) + random.randint(1, 6) + random.randint(1, 6) + random.randint(1, 6) + random.randint(1, 6) + random.randint(1, 6) + random.randint(1, 6)
    totalrolls+=1     # add all rolls. if they equal the max (48) it must be all sixes

print("it took", totalrolls, "rolls to get all sixes.", totalrolls*8, "rolls if you count the dice individually.")
input("press enter for next question...")

# Part 5
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_

print("\n\n5. calculating eroding soil")

topsoil = 35 # define variables
years = 0

while topsoil > 9: # repeat until soil is eroded beyond recovery
    topsoil = topsoil - topsoil*0.012 # erode soil
    years+=1

print("it took", years, "years until all the soil was eroded")
input("press enter for next question...")

# Part 6
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_

print("\n\n6.")

numbers = a = b = c = 0                              # define variables
print("give me a range")

while a >= c or c >= b:                              # make sure the range is valid
    try:                                             # if nothing goes wrong, do this
        a = int(input("\ngive me a min: "))
        b = int(input("give me a max: "))
        c = int(input("give me a number inbetween: "))

        if a >= c or c >= b:                         # if not, ask for new numbers
            print("you gotta stick with the format!")

    except ValueError:                               # if there is an error, make them reinput | erorr checking!
        print("of numbers. its gotta be a range of numbers")

while a != b:

    if a % c == 0: # check if a and c devide evenly
        print(a)
        numbers+=1
        a+=1

    else:
        a+=1

print("done! there are", numbers, " numbers in the range divisiable by", c)