diff --git a/Languages/Python/Project Lottery.py b/Languages/Python/Project Lottery.py new file mode 100644 index 00000000..b017e39b --- /dev/null +++ b/Languages/Python/Project Lottery.py @@ -0,0 +1,44 @@ +#IMPORT RANDOM MODULE +import random + +#CREATE VARIABLE +user_list = [] +random_list = [] +user_value = 0 +random_value = 0 +count = 0 +matches = 0 + +#GET VALUES FROM THE USER INTO A LIST +user_list.append(int(input("Insert number 1 : "))) +user_list.append(int(input("Insert number 2 : "))) +user_list.append(int(input("Insert number 3 : "))) +user_list.append(int(input("Insert number 4 : "))) +user_list.append(int(input("Insert number 5 : "))) +print("\n") + +#GET RANDOM NUMBERS INTO A LIST +random_list.append(random.randrange(1,50)) +random_list.append(random.randrange(1,50)) +random_list.append(random.randrange(1,50)) +random_list.append(random.randrange(1,50)) +random_list.append(random.randrange(1,50)) + +#DISPLAY THE USER ENTRIES +print("User number :",end = " ") +for user_value in user_list: + print(user_value,end = " ") +print("\n") + +#DISPLAY THE LOTTERY NUMBERS +print("Lottery numbers : ",end = " ") +for random_value in random_list: + print(random_value,end = " " ) + +#LOOK FOR MATCHING VALUES IN BOTH LISTS +for count in range (5): + if user_list[count] == random_list[count]: + matches +=1 + +#DISPLAY NUMBER OF MATCHES +print("\n\nYou have",matches,"matches") diff --git a/Languages/Python/dragonGame.py b/Languages/Python/dragonGame.py new file mode 100644 index 00000000..84945c6f --- /dev/null +++ b/Languages/Python/dragonGame.py @@ -0,0 +1,42 @@ +#import modules +import random +import time + +#create varibles +try_again = "" +cave_list = ["1","2","3","4"] +#process and display +def display_intro(): + print("""You are in the Kingdom of Dragons. In front of you, + you see four caves. In cave 1, the dragon is friendly + and will share his treasure with you. The dragon in cave 2 + is hungry and will eat you on sight. + The dragon in cave 3 is friendly but doesn't have any treasure. And dragon in cave 4 is hungry and he got no treasure.""") + +def choose_cave(): + cave = "" + while cave not in cave_list: + cave = input("Which cave will you go into(1/2/3/4) : ") + return cave + +def check_cave(choosen_cave): + caves = ["Gobbles you down!","Smiles, but no treasure","Gobbles you since he even doesn't even have any treasure"] + print("You approach the cave...") + time.sleep(2) + print("A large dragon jumps out in front of you! ") + print("He opens his jaws and ...") + time.sleep(2) + friendly_cave = random.randint(1,4) + if choosen_cave == str(friendly_cave): + print("Gives you his treasure!") + else: + random_cave = random.choice(caves) + print(str(random_cave)) + +while True: + display_intro() + cave_number = choose_cave() + check_cave(cave_number) + try_again = input("Do you want to try again ? (Y for yes / N for no) : ") + if try_again.lower() == "n": + break