# Day 8
# _ _ _
# _ __ __ _ _ __ __| (_)_ __ | |_
# | '__/ _` | '_ \ / _` | | '_ \| __|
# _| | | (_| | | | | (_| | | | | | |_
# (_)_| \__,_|_| |_|\__,_|_|_| |_|\__|
# random numbers
# you use the random module for randomness
import random
# random.randint(range)
# generates a random number within a specified range
# in a print fuction, end="" makes the next print on the same line
# part 1
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("1. roll 7 or 11, you win")
input("press anything to roll dice...")
# define the dice as seperate variables to display the seperate rolls
dice1 = random.randint(1,6)
dice2 = random.randint(1,6)
if dice1 + dice2 == 7 or dice1 + dice2 == 11:
print(f"you win! ({dice1} + {dice2})")
else:
print(f"you lost! ({dice1} + {dice2})")
input("press anything for next question...")
# part 2
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("\n\n2. generate three numbers ")
number1 = random.randint(1, 100)
number2 = random.randint(1, 100)
number3 = random.randint(1, 100)
print(f"the numbers are {number1}, {number2} and {number3}")
# there is probbly a more effeciany to do this (through max method or somthin)
print(f"\nthe average is {(number1+number2+number3)/3}")
if number1 > number3 and number1 == number2:
print(f"there are two highest numbers: #1 ({number1}) and #2 ({number2})")
print(f"the lowest number is #3 ({number3})")
elif number1 > number2 and number1 == number3:
print(f"there are two highest numbers: #1 ({number1}) and #3 ({number3})")
print(f"the lowest number is #2 ({number2})")
elif number2 > number1 and number2 == number3:
print(f"there are two highest numbers: #2 ({number2}) and #3 ({number3})")
print(f"the lowest number is #1 ({number1})")
elif number1 > number2 and number1 > number3:
print(f"the higest number is #1 ({number1})")
if number2 > number3:
print(f"the lowest number is #3 ({number3})")
else:
print(f"the lowest number is #2 ({number2})")
elif number2 > number1 and number2 > number3:
print(f"the higest number is #2 ({number2})")
if number1 > number3:
print(f"the lowest number is #3 ({number3})")
else:
print(f"the lowest number is #1 {number1}")
elif number3 > number2 and number3 > number1:
print(f"the higest number is #3 ({number3})")
if number2 > number1:
print(f"the lowest number is #1 ({number1})")
else:
print(f"the lowest number is #2 ({number2})")
else:
print("all the numbers are the same")
# part 3
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("\n\n3. get doubles or triples, you win")
input("press anything to roll dice...")
dice1 = random.randint(1, 6)
dice2 = random.randint(1, 6)
dice3 = random.randint(1, 6)
if dice1 == dice2 or dice1 == dice3 or dice2 == dice3:
print("you win! you got doubles")
elif dice1 == dice2 == dice3:
print("you win! you got triples")
else:
print("you lost")
input("press anything for next question")
# part 4
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("\n\n4. flip six coins. get three heads in a row, you win")
input("press anything to flip the coins...")
coin1 = random.randint(1, 2)
coin2 = random.randint(1, 2)
coin3 = random.randint(1, 2)
coin4 = random.randint(1, 2)
coin5 = random.randint(1, 2)
coin6 = random.randint(1, 2)
if coin1 == coin2 == coin3 == 1 or coin4 == coin2 == coin3 == 1 or coin4 == coin5 == coin3 == 1 or coin4 == coin5 == coin6 == 1:
print("you win! you got three heads in a row.")
else:
print("you lost. you didn't get three heads in a row")
# part 5
# _,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,__,.-'~'-.,_
print("\n\n5. Gambeling W - Roulette")
bet = -2
while bet > 36 or bet < -1:
try:
bet = int(input("what number do you want [0 - 36]: "))
if bet > 36 or bet < -1:
print("its gotta be in range")
except ValueError:
print("gotta be a number")
roll = random.randint(1, 36)
print(roll)
if bet == roll:
print("you won")
else:
print("you lost")