Есть ли способ сделать меню выбрать aimForTarget? - PullRequest
0 голосов
/ 23 февраля 2020

Нужно сделать выпадающее меню, которое выбирает игру и по какой-то причине не выбирает aimForTarget. Когда я запускаю код, появляется меню и просит меня выбрать опцию, и когда я выбираю «2», он продолжает играть в первую игру, так что я предполагаю, что что-то не так с игрой 2, но я не могу понять что это такое.


    print('Choose one of the following games to play!')

    print('1. GuessTheNumber ')
    print('2. aimForTarget ')

    choice = int(input('Choose the one of the following: '))

    if choice == 1:

        print('You are playing Guess The Number ')

    elif choice == 2:

        print('You are playing Aim For Target ')

    else:

        print('Invalid Option')


main()

# GUESS THE NUMBER

import random

secretNumber = random.randint(1, 50)

guess = int(input('I am thinking of a number between 1 and 50: '))


def guessTheNumber(guess, secretNumber):

    for guessesTaken in range(1, 5):
        print('Take a guess')
        guess = int(input())

        if guess < secretNumber:
            print('Your guess is too low.')

        elif guess > secretNumber:
            print('Your guess is too high.')

        else:
            break

    if guess == secretNumber:
        print('Good Job! You guessed my number in ' + str(guessesTaken) + ' guesses!')

    else:
        print('Game Over. You used up all your tries. ' + str(secretNumber))


guessTheNumber(guess, secretNumber)


# AIM FOR TARGET

import random

player1 = input('Player 1 enter your first name:  ')

num1 = int(player1, + 'please enter a number between 1 and 200 (inclusive: 60:  )')

player2 = input('Player 2 enter your first name:  ')

num2 = int(player2, + 'please enter a number between 1 and 200 (incluive: 60: )')

circle1 = range(1, 50)
circle2 = range(51, 100)
circle3 = range(101, 150)
circle4 = range(151, 200)

comp = random.randint(1, 4)

player01 = (player1 > player2)

player02 = (player2 > player1)


def aimfortarget(num1, comp):

    if comp == num1 or num2:
        print('You get all the points for that circle.')

    elif num1 >= circle1 or num2 >= circle1:
        (num1 - circle1) // 2
    print(comp + 'chosen circle upper range is your number of point')

    if num1 <= circle4 or num2 <= circle4:
        print(comp // 2)

    else:
        print('Players we have a tie.')


aimForTarget(num1, num2)


def getpoints(usernum, rndcirclenum):

    usernum = int(input('Write your chosen number: '))

    rndcirclenum = round(num1)

    print('Points for are ' + player1)

    roundcirclenum = round(num2)

    if player01 > player02:
        print(player01 + ' Wins')

    else:
        print(player02 + ' Wins')


getPoints(usernum, rndcirclenum)```

...