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

'''
today is about while loops

there are two kinds of loops
definate loops - # of iterations is known
infinate loops - keeps going and going and going and going and going and going

while loops iterate until a condition is no longer met
"do this as long as this is happen"

modify interger variables with + or - after then = the amount
for example
number+=1 will add one
number-=4 will subtract four
'''

# 1.
print("\n1.")

# store variable
password = ""
username = ""

# ask for username and password
while username.strip()!="bear" or password.strip()!="grills":

    username = input("enter username: ")
    password = input("enter password: ")

    if username=="bear" and password=="grills": #check if correct
        print("correct login")

    else:
        print("Incorrect login - Try Again")

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

print("\n2.")
print("this will print every number between 1 and 1000 and add them")
input("press enter to start...")

sum = 0
number = 0

while (number<=999):           # in each iteration:
    print("Number is ",number) # print number
    number+=1                  # increase number
    sum = sum + number         # add new number to sum

print("the sum of all the numbers is ",sum)

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

print("\n3.")

totalnumber = 0
addingnumber = 0

while addingnumber != -1:
    addingnumber = int(input("\ngive me a number (write -1 to stop): "))
    number3 = totalnumber + addingnumber

    if addingnumber != -1:
        print("the current total is", totalnumber)

    else:
        print("the final total is", totalnumber)