def calculator():
    print(logo)
    num1 = float(input("What's the first number?: "))
    for symbol in operations:
        print(symbol)
    should_continue = True
    while should_continue:
        operation_symbol = input("Pick an operation: ")
        num2 = float(input("What's the next number?: "))
        calculation_function = operations[operation_symbol]
        answer = calculation_function(num1, num2)
        print(f"{num1} {operation_symbol} {num2} = {answer}")
        choice = input(
            f"Type 'y' to continue calculating with {answer}, or type 'n' to start a new calculation, or type 'exit' to exit: "
        )
        if choice == 'y':
            num1 = answer
        elif choice == 'n':
            should_continue = False
            clear()
            calculator()
        elif choice == 'exit':
            return
Example #2
0
def game():
    print(logo)
    score = 0
    game_should_continue = True
    account_a = get_random_account()
    account_b = get_random_account()

    while game_should_continue:
        account_a = account_b
        account_b = get_random_account()

        while account_a == account_b:
            account_b = get_random_account()

        print(
            f"Compare A: {account_a['name']}, a { account_a['description']}, from { account_a['country']}.")
        print(vs)
        print(
            f"Against B: {account_b['name']}, a { account_b['description']}, from { account_b['country']}.")

        while True:
            guess = input("Who has more followers? Type 'A' or 'B': ").lower()
            if guess in ['a', 'b']:
                break
            print('Not a valid input')
        a_follower_count = account_a["follower_count"]
        b_follower_count = account_b["follower_count"]
        is_correct = check_answer(guess, a_follower_count, b_follower_count)

        clear()
        print(logo)
        if is_correct:
            score += 1
            print(f"You're right! Current score: {score}.")
        else:
            game_should_continue = False
            print(f"Sorry, that's wrong. Final score: {score}")
Example #3
0
def play():
    # setup variables
    score = 0
    is_start = True
    lost_game = False

    while True:
        replit.clear()
        print(art.logo)

        if is_start == False:
            print(f"You're right! Current score: {score}.")
        a, b = load_people()

        print(
            f"Compare A: {a['name']}, a {a['description']}, from {a['country']}"
        )
        print(art.vs)
        print(
            f"Compare B: {b['name']}, a {b['description']}, from {b['country']}"
        )
        answer = input("Who has more followers? Type 'A' or 'B': ")

        # check answer
        if a['follower_count'] > b['follower_count'] and answer == "A":
            score += 1
            is_start = False
            continue
        elif a['follower_count'] > b['follower_count'] and answer == "B":
            break
        elif a['follower_count'] < b['follower_count'] and answer == "A":
            break
        else:
            score += 1
            is_start = False
            continue
    print(f"Sorry, that's wrong. Final score: {score}")
Example #4
0
def game():
    print(logo)

    score = 0
    continue_game = True
    option_a = get_random_account()
    option_b = get_random_account()

    while continue_game:
        option_a = option_b
        option_b = get_random_account()

        while option_a == option_b:
            option_b = get_random_account()

        print(f"Compare A: {format_account_data(option_a)}")
        print(vs)
        print(f"Compare B: {format_account_data(option_b)}")

        user_guess = input(
            "\nWhich one has more instagram followers? Type 'A' or 'B': "
        ).lower()
        a_follower_count = option_a["follower_count"]
        b_follower_count = option_b["follower_count"]

        is_correct = check_answer(user_guess, a_follower_count,
                                  b_follower_count)

        clear()
        print(logo)

        if is_correct:
            score += 1
            print(f"You are correct. Current score: {score}.")
        else:
            continue_game = False
            print(f"Oops! That's wrong. Final score: {score}.")
def higherFollowersNumberGame():
    clear()
    print(logo)
    print("Welcome to the Instagram followers higher lower game.")

    randomDictEntry1 = randomInt()

    usersScore = 0

    currentlyPlaying = True

    while currentlyPlaying:
        #Player keeps choosing who he thinks has more followers
        #Computer displays entries and calculates if user is righta
        randomDictEntry2 = randomInt()
        if randomDictEntry1 == randomDictEntry2:
            randomDictEntry2 = randomInt()

        if usersScore > 0:
            print(f"That's right. Your current score is {usersScore}.")

        winnerFollowers = printDictData(randomDictEntry1, randomDictEntry2)

        usersChoice = ""
        usersChoice = input(
            "Who has more followers? Type 'A' or 'B': ").lower()

        if usersChoice == 'a' and winnerFollowers == 0 or usersChoice == 'b' and winnerFollowers == 1:
            #continue playing
            randomDictEntry1 = randomDictEntry2
            usersScore += 1
            clear()
            print(logo)
        else:
            #game is lost
            print("I'm sorry, you lost")
            currentlyPlaying = False
def pick_number():
    turns_remaining = difficulty(players_difficulty)
    game_over = False
    while not game_over:
        print(f"You have {turns_remaining} remaining.")
        guess_number = int(input("Make a guess:  "))
        if turns_remaining == 0:
            print("Ran out of guesses you lose!")
            game_over = True
        if guess_number == computers_number:
            print(f"You win! The number was {computers_number}.")
            game_over = True
        else:
            turns_remaining -= 1
            compare(guess_number, computers_number)
            if turns_remaining == 0:
                print(
                    f"You ran out of guesses. The number was {computers_number}"
                )
                game_over = True
                if input("Want to play again? Type 'y' or 'n': ") == 'y':
                    clear()
                    print(logo)
                    pick_number()
Example #7
0
def calculator():
    """ a calculator function"""
    clear()
    print(logo)
    print('type c anytime to clear\n')

    result = input("Enter the first number\n")
    result = num_check(result)

    while True:
        operator = operator_check()
        operation = operations[operator]
        num2 = input("\nEnter the next number\n")
        num2 = num_check(num2)

        num1 = result
        result = operation(result, num2)
        # removing trailing zero if results in a single zero decimal
        if (result * 10) % 10 == 0:
            result = int(result)

        print(
            f"""\n____________________________\n\n{num1} {operator} {num2} = {result}\n____________________________"""
        )
Example #8
0
def reset():
    print('''
MAIN MENU
=========

-> For instructions on how to play, type 'I'
-> To play immediately, type 'P')
''')

    choice = input('Type here: ').upper()

    if choice == 'I':

        #Prints Instructions
        print(open('instructions.txt', 'r').read())

        input('Press [enter] when ready to play.')

    elif choice != 'P':
        replit.clear()
        reset()

    puz = generate_puzzle()
    play(puz)
Example #9
0
def configmenu(data):
    replit.clear()
    print(
        colorText(
            '[[' + defaultcolor +
            ']]________                          \n___  __ \___________ ______ ______\n__  /_/ /  _ \_  __ `/  __ `/__  /\n_  ____//  __/  /_/ // /_/ /__  /_\n/_/     \___/_\__, / \__,_/ _____/\n             /____/               \n\nAuthor : @Coroxx on GitHub\nVersion : 1.0\n'
        ))
    choice = input(
        colorText(
            '[[' + defaultcolor +
            ']]\n[1] Add a new configuration\n[2] Modify a configuration\n[3] Delete a configuration\n\n[0] Back\n\n[?] Choice : '
        ))
    if choice == '0':
        hub()
    elif choice == '1':
        newconfig()
    elif choice == '2':
        configmodify(data)
    elif choice == '3':
        configdelete(data)
    else:
        print(colorText('[[red]]\n[!] Incorrect choice !'))
        time.sleep(1)
        configmenu(data)
Example #10
0
def calculator():

    num1 = float(input("What's the number?\n"))
    for element in operations:
        print(element)
    gameOn = True
    while gameOn:
        oper_symbol = input("Which operation would you like to use?\n")
        num2 = float(input("What is the number? \n"))

        symbol_picked = operations[oper_symbol]

        answer = symbol_picked(num1, num2)

        print(f"{num1}{oper_symbol}{num2} = {answer}")
        continueValue = input(
            f"Type 'y' to continue calculator with {answer}, or type 'n' to exit: \n"
        )
        if continueValue == "y":
            num1 = answer
        else:
            clear()
            gameOn = False
            calculator()
Example #11
0
def CheckNRIC():
    global NRIC
    replit.clear()
    NRIC = str(input("Input NRIC here: "))
    NRIC = NRIC.upper()
    if len(NRIC) != 9:
        print("Invalid NRIC Number!")
        time.sleep(2.5)
        replit.clear()
        CheckNRIC()
    elif NRIC[-1].isdigit() or NRIC[0].isdigit():
        print("Invalid NRIC Number!")
        time.sleep(2.5)
        replit.clear()
        CheckNRIC()
    elif not NRIC[1:8].isdigit():
        print("Invalid NRIC Number!E")
        time.sleep(2.5)
        replit.clear()
        CheckNRIC()
Example #12
0
def game():
    global BET
    global BALANCE
    global ROUNDS

    choice = random.randint(0, 5)
    number_chosen = start()

    if choice == number_chosen:
        print(f"You win the correct number was {choice}")
        BALANCE += BET
        print(f"\nCurrent balance is ${BALANCE}\n")

    elif choice != number_chosen:
        print(f"One more attempt")
        new_number = int(input(f"Pick one more number between 1 and 5 : "))
        ROUNDS += 1

        if new_number == choice:
            print(f"You win the correct number was {choice}")
            BALANCE += BET
            print(f"\nCurrent balance is ${BALANCE}\n")

        else:
            print(f"You lose the correct number was {choice}")
            BALANCE -= BET
            print(f"\nCurrent balance is ${BALANCE}\n")

    while BALANCE < 10000 and BALANCE > 0:
        go_again = input("Press return or enter to Contiue ")
        clear()
        game()

    while BALANCE >= 10000:
        do_checkout = input(
            f"Do you want to check out current balance is ${BALANCE}? 'y' to check out / 'n' to contiune : "
        )
        while do_checkout != "y":
            clear()
            game()

    while BALANCE <= 0:
        tries = float(f"{0.}{ROUNDS}")
        go_again = input(
            f"You guessed a total of {ROUNDS} tries and lost $2500, \npress Enter or Return to try again"
        )

        BALANCE = 2500
        ROUNDS = 0
        clear()
        game()
Example #13
0
def place_order(profit):
    trigger_order = False
    while trigger_order != True:
        print("\nWhat would you like to order?")
        print("     - Latte\n     - Cappuccino\n     - Espresso")
        order = input("_____________________________\n").lower()
        if order == "cappuccino" or order == "latte" or order == "espresso":
            clear()
            trigger_order = True
        elif order == "report":
            clear()
            status_report(profit)
        else:
            clear()
            print("INVALID INPUT!")
    return order
Example #14
0
def Rerun():
    Confirm = str(input("\nRerun the code?[Y or N] : "))
    if Confirm.startswith('Y') or Confirm.startswith('y'):
        if Opinion == "Y" or "y":
            replit.clear()
            RunAll()
        elif Opinion == "N" or "n":
            replit.clear()
            RunLess()
    elif Confirm.startswith('N') or Confirm.startswith('n'):
        replit.clear()
        exit()
    else:
        print("Invalid Input!")
        time.sleep(1.5)
        Options()
def menu():
    plr.exit_menu = False
    while not plr.exit_menu:
        replit.clear()
        print('-- MENU --')
        print('[Inventory]\n[Stats]\n[Exit]\n')
        entry = input('> ').lower()
        if entry == '' or entry == 'exit':
            plr.exit_menu = True
        else:
            try:
                replit.clear()
                menu_options[entry](plr)
            except KeyError:
                input('Invalid command.')
        replit.clear()
Example #16
0
def play():
	replit.clear()
	blankBoard = [['-','-','-'],['-','-','-'],['-','-','-']]
	win = False
	tie = False
	player = 1
	printMatrix(blankBoard)
	while win == False and tie == False:
		if player == 1:
			print('X turn')
			row = int(raw_input('Row 1, 2 or 3? '))
			if row > 3 or row < 1 or row == '':
				row = int(raw_input('Invalid row. Row 1, 2 or 3? '))
			column = int(raw_input('Column 1, 2 or 3? '))
			if column > 3 or column < 1 or column == '':
				column = int(raw_input('Invalid column. Column 1, 2 or 3? '))
			if blankBoard[(row-1)][(column-1)] == '-':
				blankBoard[(row-1)][(column-1)] = 'X'
				player = 2
			elif blankBoard[(row-1)][(column-1)] != '-':
				print('Spot already taken')
				player = 1
			replit.clear()
			printMatrix(blankBoard)
			win = checkWin(blankBoard)
			tie = checkTie(blankBoard)
		else:
			print('O turn')
			row = int(raw_input('Row 1, 2 or 3? '))
			if row > 3 or row < 1 or row == '':
				row = int(raw_input('Invalid row. Row 1, 2 or 3? '))
			column = int(raw_input('Column 1, 2 or 3? '))
			if column > 3 or column < 1 or column == '':
				column = int(raw_input('Invalid column. Column 1, 2 or 3? '))
			if blankBoard[(row-1)][(column-1)] == '-':
				blankBoard[(row-1)][(column-1)] = 'O'
				player = 1
			elif blankBoard[(row-1)][(column-1)] != '-':
				print('Spot already taken')
				player = 2
			replit.clear()
			printMatrix(blankBoard)
			win = checkWin(blankBoard)
	if win == True:
		print blankBoard[(row-1)][(column-1)] + ' wins!'
	elif tie == True:
		print('Tie game')
Example #17
0
def intro():
    global player, name, password, money, sales, unity, pro101
    print("\n")
    print("welcome to biz sim! Are you new to the game?")
    new = input("> ")
    if new == "yes":
        clear()
        print("\n")
        print("ok, great! We need to set up a account for you.")
        print("Please enter your name:")
        player = input("> ")
        print("now enter the name of your new business:")
        name = input("> ")
        print("and now, what will your business produce:")
        product = input("> ")
        pro101 = Product(product, 10, 1000, 100)
        print("and finally, we need a password for your account.")
        password = input("> ")
        money = 1000
        clear()
        print("\n")
        print("Thank you for playing! Please enjoy!")
        saving()
        main()
    elif new == "no":
        print("ok, please enter your name:")
        player = input("> ")
        print("And now enter your business name:")
        name = input("> ")
        loading()
        print("ok, what is your password?")
        ptry = input("> ")
        if ptry == password:
            clear()
            print("access granted. Welcome, " + player)
            sleep(1)
            main()
        else:
            print("password incorret. Please try again.")
    elif new == "Kiritsigu":
      player = "Emiya"
      name = "Unlimited blade works"
      loading()
      main()
    else:
        print("error! Try again.")
Example #18
0
def game(selection_one, selection_two):

    global score

    print(art.logo)

    print(score_check())

    print(display_selection_one(selection_one))

    print(art.vs)

    print(display_selection_two(selection_two))

    user_choice = (input("Who has more followers? Type 'A' or 'B': "))

    if user_choice == 'A':
        if selection_one['follower_count'] > selection_two['follower_count']:
            clear()
            score += 1
            new_selection = new_selection_choice(selection_two)
            game(selection_two, new_selection)
        else:
            clear()
            print(art.logo)
            print("You lose!")
    elif user_choice == 'B':
        if selection_one['follower_count'] < selection_two['follower_count']:
            clear()
            score += 1
            new_selection = new_selection_choice(selection_two)
            game(selection_two, new_selection)
        else:
            clear()
            print(art.logo)
            print("You lose!")
Example #19
0
def CheckValid():
    y = 0
    a = 0
    b = 1
    x = 0
    ST = ['J', 'Z', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A']
    FG = ['X', 'W', 'U', 'T', 'R', 'Q', 'P', 'N', 'M', 'L', 'K']

    NRICint = NRIC[1:-1]
    NRICweight = "2765432"
    while x != 7:
        y = y + (int(NRICweight[a:b])) * (int(NRICint[a:b]))
        a += 1
        b += 1
        x += 1
    if NRIC.startswith('S') or NRIC.startswith('F'):
        y = y % 11

    elif NRIC.startswith('T') or NRIC.startswith('G'):
        y += 4
        y = y % 11

    if NRIC.startswith('S') or NRIC.startswith('T'):
        if ST[y] == NRIC[-1]:
            print("This NRIC is a Valid NRIC")
        else:
            print("This NRIC is a Invalid NRIC!")
            time.sleep(2.5)
            replit.clear()
            Rerun()
    elif NRIC.startswith('F') or NRIC.startswith('G'):
        if FG[y] == NRIC[-1]:
            print("This NRIC is a Valid NRIC")
        else:
            print("This NRIC is a Invalid NRIC!")
            time.sleep(2.5)
            replit.clear()
            Rerun()
    else:
        print("Invalid NRIC!")
        time.sleep(2.5)
        replit.clear()
        Rerun()
Example #20
0
def learn(scene_name, learn_time):
    learn_first_time_intro = "Great, let's learn! Look around here and tell me a word in English.\nWhat do you want to learn the Blackfoot word for? Type it in English, or type done to finish. "
    learn_intro = "What do you want to learn the Blackfoot word for? "

    translations = open("translation.csv")
    scene_words = {}

    for line in translations:
        data = line.split(",")
        if data[0] == scene_name:
            scene_words[data[1]] = data[2].replace('\n', '')

    keep_learning = True

    while keep_learning:
        if learn_time == 0:
            eng_input = input(learn_first_time_intro +
                              learn_intro).lower().strip("!?,. ")
            learn_time += 1
        else:
            eng_input = input(learn_intro).lower().strip("!?,. ")

        valid_word = False

        for key, value in scene_words.items():
            if eng_input == key:
                valid_word = True
                bf_output = value
                print(bf_output)
                audio.play_file("sounds/" + key + ".wav")
                sleep(3)
            elif eng_input == "done":
                replit.clear()
                keep_learning = False

        if valid_word:
            replit.clear()
            return learn(scene_name, learn_time)
        elif not valid_word and keep_learning:
            print("Sorry, I don't know that one. Try another word!")
            sleep(2)
            replit.clear()
Example #21
0
def play_game():
    print(logo)
    print("Welcome to game Higher or Lower!")
    should_continue = True
    score = 0
    accountA = random_account()
    accountB = random_account()

    # while combine first round and next round(first round also change a to b)
    while should_continue:
        accountA == accountB
        accountB = random_account()
        # check accountA differs B
        if accountB == accountA:
            accountB = random_account()
        print(f"Compare A: {print_format(accountA)}")
        print(vs)
        print(f"Against B: {print_format(accountB)}")
        # user guess
        guess = input("\nWho has more followers? Type'A' or 'B'.\n").upper()
        # check if answer is_correct = true
        is_correct = check_answer(guess, accountA, accountB)
        # next situation, clear.if correct, continue, score +1. if wrong, restart or exit.
        clear()
        print(logo)
        if is_correct:
            score += 1
            print(f"You are right! Current score :{score}\n")
        else:
            should_continue = False
            print(
                f"Your score is :{score}\n Come onnnn, u can do better.\n Keep trying"
            )
            if input("type 'y' to have another round, type 'n' to exit."
                     ).lower() == 'y':
                clear()
                play_game()
            else:
                clear()
                print("Good Bye.")
Example #22
0
def game():
    score = 0

    first = pickCelebrity(gameData)
    second = pickCelebrity(gameData, first['name'])
    game_continue = True

    replit.clear()

    while game_continue:
        print(logo)

        # Print out score
        if score > 0:
            print(f"You're roght! Current score: {score}")

        print(
            f"Compare A: {first['name']}, {first['description']}, from {first['country']}"
        )
        print(vs)
        print(
            f"Compare B: {second['name']}, {second['description']}, from {second['country']}"
        )
        guess = input("Who has more followers? Type 'A' or 'B': ")

        result = checkFollowers(guess, first['follower_count'],
                                second['follower_count'])
        if result:
            score += 1
            first = second
            second = pickCelebrity(gameData, first['name'])
            replit.clear()
        else:
            game_continue = False
            replit.clear()
            print(logo)
            print(f"Sorry, that's wrong. Final score: {score}")
Example #23
0
from art import logo
from replit import clear

print(logo)
if (input("can i clear the screen\n") == 'yes'):
    clear()
#HINT: You can call clear() to clear the output in the console.
Example #24
0
def clear():
    replit.clear()
Example #25
0
import time
paulh = ["MailA: hello", "MailB: hi", "MailC: yep", "MailD: nothing here"]
bob3 = [
    "MailA: yep", "MailB: still nothing", "MailC: unlucky",
    "MailD: empty user here"
]
hoolianJayzam = ["MailA: nah dawg nothing here still"]
notAHacker = ["MailA: Payment for Services"]
MailA = [
    "to paul: hello.", "to bob3: hello.", "to hollian: nope", "fishy stuff"
]
MailB = ["another one to paul: hi", "hi bob, nothing here"]
MailC = ["paul, le nope", "you lost dude"]
MailD = ["paul, your an idiot.", "bob ur empty"]
users = [paulh, bob3, hoolianJayzam, notAHacker]
replit.clear()
username = input(colored("to start the game, enter a username", "cyan"))
password = input(colored("and enter a password as well", "cyan"))
c("Welcome to  CypherLink, " + username, "green")
c("cl.software state: v01", "green")
c("type cl.help to begin", "green")
userconnect = username


def play():
    global userconnect, paulh, users
    Mail = "ABCD"
    command = input(colored("~cl.local." + userconnect + "~", "red"))
    if command == "cl.help":
        c("commands:\ncl.help\nrc-check\nrc-connect\nfList", "green")
    elif command == "rcheck":
Example #26
0
def blackjack(play_count):
  def total_sum(player):
      total_score = sum(player)
      return total_score

  def check_ace(player):
      if sum(player) > 21:
          if 11 in player:
              position = player.index(11)
              player[position] = 1

  def is_blackjack(player):
      if sum(player) == 21:
          return True
      else:
          return False

  def is_burst(player):
      if sum(player) > 21:
          return True
      else:
          return False

  def print_scores():
      print(
          f"Computer cards are {computer} . Total is {total_sum(computer)}")
      print(f"Your cards are {user} . Total is {total_sum(user)}")

  def you_win():
      print_scores()
      print("You win")

  def computer_win():
      print_scores()
      print("Computer wins")

  def in_play_proc():
    nonlocal user_in_play_flg
    nonlocal comp_in_play_flg

    print(f"Computer's 1st card is {computer[0]}")
    print(f"Your cards are {user} . Total is {total_sum(user)}")

    #ユーザのターン
    if user_in_play_flg == True:
      if input("Do you draw another card? 'y' or 'n':  ") == "y":
        card = random.choice(cards)
        user.append(card)
        check_ace(user)
        print(f"Your cards are {user} . Total is {total_sum(user)}")
        if is_blackjack(user) or is_burst(user):
            user_in_play_flg = False
            comp_in_play_flg = False
      else: #ユーザがひかなかったとき
        user_in_play_flg = False

    #コンピュータのターン
    if sum(computer) <= 16: #コンピュータがもう1枚ひいたとき
      print("computer draws one more card.")
      card = random.choice(cards)
      computer.append(card)
      check_ace(computer)
      if is_blackjack(computer)or is_burst(computer):
        user_in_play_flg = False
        comp_in_play_flg = False
    else: #コンピュータがひかなかったとき
      print("computer does not draw.")
      comp_in_play_flg = False

  def disp_result():
    print("-----game set.-----game result is...")
    #コンピュータがブラックジャックの場合
    if is_blackjack(computer):
      computer_win()
    #コンピュータがバーストの場合
    elif is_burst(computer):
      you_win()
    #ユーザがブラックジャックの場合
    elif is_blackjack(user):
      you_win()
    #ユーザがバーストの場合
    elif is_burst(user):
      computer_win()
    #上のいづれでもない場合
    else:
      computer_score = sum(computer)
      user_score = sum(user)
      if computer_score > user_score:
          computer_win()
      elif computer_score == user_score:
          print_scores()
          print("It's a draw")
      elif computer_score < user_score:
          you_win()

  clear()
  print(logo)
  user_in_play_flg = True
  comp_in_play_flg = True
  user = []
  computer = []
  cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]

  print("play count=" + str(play_count))

  # 初回の手札を決める
  for i in range(0, 2):
      card = random.choice(cards)
      computer.append(card)
      card = random.choice(cards)
      user.append(card)

  # コンピュータが勝っていたら
  if is_blackjack(computer):
      user_in_play_flg = False
      comp_in_play_flg = False

  # ユーザが勝っていたら
  if is_blackjack(user):
      user_in_play_flg = False
      comp_in_play_flg = False

  # 初配で勝敗が決まらなかったとき
  while user_in_play_flg or comp_in_play_flg:
    in_play_proc()

  #勝敗を判定するとき
  disp_result()

  #もう1ゲームやるか
  if input("Do you want to play again? 'y' or 'n': ") == "y":
    return "continue"
  else:
    return "end"
Example #27
0
print("2020 | @Cmlohr")
print("-------------------")

user_bids = {}
bidding_end = False


def the_high_bidder(bidding_log):
    high_bid = 0
    won = ""
    for bidder in bidding_log:
        user_bids = bidding_log[bidder]
        if user_bids > high_bid:
            high_bid = user_bids
            won = bidder
    print("------------------------------------------------------")
    print(f"The highest bidder is {won} with a bid of ${high_bid}!")


while not bidding_end:
    name = input("What is your name?\n>> ")
    bid = int(input("How much would you like to bid?\n>> $"))
    user_bids[name] = bid
    add_bidders = input("Any other bidders, Y or N?\n>> ").lower()
    if add_bidders == "n":
        bidding_finished = True
        the_high_bidder(user_bids)
        break
    elif add_bidders == "y":
        clear()  #imported repl.it clear
Example #28
0
end_of_game = False
lives = 6
chosen_word = random.choice(word_list)

#testing code
#print(f"The choosen word is: {chosen_word}")

length = len(chosen_word)
for _ in range(length):
    display += "_"


while not end_of_game:
    guess = input("Guess a letter: ").lower()

    clear() #Clear the screen after each guess

    #Formating  
    print(f"{' '.join(display)}")

    if guess not in chosen_word:
        print(f"\nYou guessed {guess}, that's no in the word. You loose a life!")

    if guess in display:
        print(f"\nYou have already guessed {guess}.")

    #Check if the letter the user guessed is one of the letters in the chosen_word.
    for position in range(length):
        letter = chosen_word[position]
        if letter in guess:
            display[position] = letter
Example #29
0
def cls():
    if windows:
        clear()
    else:
        replit.clear()
Example #30
0
def retorno_estimativa_pib():
    op_voltar = str(input("\nUse qualquer tecla para volar ao menu...\n"))
    if len(op_voltar) >= 0:
        replit.clear()
        menu()