learning from 100 Days of Code: The Complete Python Pro Bootcamp for 2022
# Banker Roulette
import random
test_seed = int(input("Create a seed number: "))
random.seed(test_seed)
# Split string method
names_string = input("Give me everybody's names, separated by a comma. ")
names = names_string.split(", ")
num_of_part = len (names)
who = names[ random.randint(0,num_of_part -1 ) ]
print(f" {who} is going to buy the meal today!" )
# instead of use random.choice
who = random.choice(names)
print(f"{who} is going to buy the meal today!")
# Treasure Map
row1 = ["⬜️","⬜️","⬜️"]
row2 = ["⬜️","⬜️","⬜️"]
row3 = ["⬜️","⬜️","⬜️"]
map = [row1, row2, row3]
print(f"{row1}\n{row2}\n{row3}")
position = input("Where do you want to put the treasure? ")
map[ int(position[1])-1 ] [ int(position[0])-1 ] = "X"
print(f"{row1}\n{row2}\n{row3}")
#Rock Paper Scissors
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
import random
game_image = [ rock , paper , scissors ]
my_play = int(input("What do you want to chose? Type 0 for Rock, 1 for Paper or 2 for Scissors.\n"))
if my_play >= 3 or my_play < 0:
print("\nYou typed an invalid number. You lose!")
else:
print(game_image [my_play] )
print("Computer chose:")
com_play = random.randint(0,2)
print(game_image [com_play] )
if my_play == com_play :
print("It's a draw")
elif my_play - com_play == 1 or (my_play == 0 and com_play ==2):
print("You win!")
else:
print("You lose!")