def wanna_play(): title('HEADS OR TAILS') instructions('Welcome to the game Heads or Tails.\n' 'We can sort 2 sides of the coin.') try: player = str(input( 'Do you want to play Heads or Tails [Y/N]: ')).upper().strip()[0] line() while player not in 'YN': print('Enter only Y or N.') return line(), wanna_play() except: return wanna_play() else: if player == 'Y': print(f'Your side of the coin was {sort_side()}') return line(), contin() else: while True: line() print('See you soon!') break
def option_chosen(): title('TEMPERATURE CONVERTER') instructions('Welcome, here you can convert Cº to Fº or Fº to Cº.\n' '[1] - Convert Cº to Fº\n' '[2] - Convert Fº to Cº\n' '[3] - Exit') try: opt = int(input('Which option: ')) if type(opt) != int: print('It is not a numnber.') return line(), option_chosen() except: print('It is not a number.') return line(), option_chosen() else: if opt == 1: convert_celsius_to_faren() elif opt == 2: convert_faren_to_celsius() elif opt == 3: while True: print('See you soon!') break
def login(): id_user = int(input('Insert your ID: ')) password_user = str(input('Insert your PASSWORD:'******'Access allowed!\nWelcome {cliente}') return title('ARCADE'), menu_game(), chosen_option() except: print('Access Denied! Try again!') return line(), login()
from Functions import menu from Functions import title title('Bank System') menu()
def header(): title('KICK A NUMBER') instructions( 'Hello, welcome to the game KICK A NUMBER\n' 'The machine will draw a number and you will have to get it right.\n' 'Good Luck.')
from Functions import line, title from databank import register, login title('ACCESS PAINEL') print('[1] - Login\n' '[2] - Sign UP\n' '[3] - Exit') line() def check_registration(): try: user = int(input('Wich option you chosed: ')) if type(user) != int: print('Enter only the chosen number!') return line(), check_registration() except: line() print('Enter only the chosen number!') return line(), check_registration() else: if user == 1: return login() elif user == 2: return register() elif user == 3: while True: print('See you soon!') line() break
def show_menu(): title('ACCESS PAINEL') print('[1] - Login\n' '[2] - Sign UP\n' '[3] - Exit') line() check_registration()
def verify_numb(): title('JO-KEN-PÔ') instructions('Hello, choose between Scissors, Paper or Rock.\n' '[0] - Scissors\n' '[1] - Paper\n' '[2] - Rock') try: player = int(input('Enter your number: ')) # Checking if the data entered are numbers. if type(player) != int or player > 3: print('Enter only the chosen number!') return line(), verify_numb() except: print('Enter only the chosen number! ') return line(), verify_numb() else: machine = randint(0, 2) # Getting names to sort machine numbers if machine == 0: name_machine = 'Scissors' elif machine == 1: name_machine = 'Paper' else: name_machine = 'Rock' if player == 0: player_choice = 'Scissors' elif player == 1: player_choice = 'Paper' else: player_choice = 'Rock' # Checking the results to get a winner. if player == 0 and machine == 0: print(f'Machine: {name_machine} X Player: {player_choice}\n' f'Tie in the game!') return line(), contin() elif player == 1 and machine == 1: print(f'Machine: {name_machine} X Player: {player_choice}\n' f'Tie in the game!') return line(), contin() elif player == 2 and machine == 2: print(f'Machine: {name_machine} X Player: {player_choice}\n' f'Tie in the game!') return line(), contin() elif player == 0 and machine == 1: player_points.append(1) print( f'Machine: {name_machine} X Player: {player_choice}\n' f'You win!\n' f'Machine Points: {sum(machine_points)} x Player Points: {sum(player_points)}' ) return line(), contin() elif player == 1 and machine == 2: player_points.append(1) print( f'Machine: {name_machine} X Player: {player_choice}\n' f'You win!\n' f'Machine Points: {sum(machine_points)} x Player Points: {sum(player_points)}' ) return line(), contin() elif player == 2 and machine == 0: player_points.append(1) print( f'Machine: {name_machine} X Player: {player_choice}\n' f'You win!\n' f'Machine Points: {sum(machine_points)} x Player Points: {sum(player_points)}' ) return line(), contin() else: machine_points.append(1) print( f'Machine: {name_machine} X Player: {player_choice}\n' f'Machine win!\n' f'Machine Points: {sum(machine_points)} x Player Points: {sum(player_points)}' ) return line(), contin()