please help!

Discussion in 'Python' started by VV123, Mar 23, 2016.

  1. VV123

    VV123

    Joined:
    Mar 22, 2016
    Messages:
    1
    Likes Received:
    0
    Hi
    I need some help, not sure what I can do to fix this code.

    import random
    gamerun = 1
    playername = 1
    roundask = 1
    topicchoice = 1
    question = 1
    answered = []
    count = 0
    p1score = 0
    p2score = 0
    restart = 1
    while gamerun == 1:
    playername = 1
    roundask = 1
    topicchoice = 1
    question = 1
    answered = []
    count = 0
    p1score = 0
    p2score = 0
    restart = 1
    rounddone = 1

    p1 = input (' What is your name?')
    p2 = input (' What is your name?')
    while roundask == 1:
    roundchoice = input('How many rounds would you like to play?')
    if roundchoice == '1':
    roundchoice = 1
    roundask = 0
    elif roundchoice == '2':
    roundcount = 2
    roundask = 0
    elif roundchoice == '3':
    roundchoice = 3
    roundask = 0
    else:
    print ('You can choose 1, 2 or 3 rounds')

    while rounddone <= roundchoice:
    while topicchoice == 1:
    choice = input ('topic choices are: Animals, Sports Brands and Sports ')
    if choice == 'Animals':
    topic = open ('Animals.txt', "r")
    topicchoice = 0
    elif choice == 'Sports Brands':
    topic = open ('Sports Brands.txt', "r")
    topicchoice = 0
    elif choice == 'Sports':
    topic = open ('Sports.txt', "r")
    topicchoice = 0
    else:
    print (' Please choose a valid topic ')
    turn = (random.choice([p1, p2]))

    while question < 5:
    print ("it is",turn,"'s turn" )
    playeranswer = input (' Make a guess! ')
    for line in topic:
    if playeranswer in answered:
    print ('Answered')
    elif playeranswer in line:
    print ('Correct!!')
    question = question + 1
    count = count + 1
    answered.append(playeranswer)
    else:
    print('Incorrct!!')
    if turn == p1:
    p1score = p1score + count
    turn = p2
    count = 0
    elif turn == p2:
    p2score = p2score + count
    turn = p1
    count = 0

    if turn == p1:
    p1score = p1score + count
    turn = p2
    count = 0
    rounddone = rounddone + 1
    elif turn == p2:
    p2score = p2score + count
    turn = p1
    count = 0
    rounddone = rounddone + 1
    while restart == 1:
    askreplay = input ('Would you like to play again?')
    if askreplay == 'yes':
    restart = 0
    elif askreplay == 'no':
    restart = 0
    gamerun = 0
    else:
    print('yes or no')

    This is an assignment I have to hand in pretty soon, and it's really hard for my level so I'm having difficulties running it, if someone could help me it'd be much appreciated. Thank you.
    Purpose/Details:

    In this game you are to load a series of categories and responses based on topic. The player is then given a topic and asked to pick the top 5 responses if they get one incorrect the opposing player may guess. This continues until all 5 responses are found. The player with the most responses wins.

    The game must read in the categories and responses from a specified text file. It should then allow players to enter their name and select up to 3 rounds. At the end it declares a winner.
     
    VV123, Mar 23, 2016
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JC
    Replies:
    4
    Views:
    8,275
    Jeff C
    Jul 8, 2004
  2. Gandu
    Replies:
    0
    Views:
    1,314
    Gandu
    Jan 8, 2004
  3. Ayeda

    Please Please Help!!

    Ayeda, Jan 10, 2004, in forum: Java
    Replies:
    9
    Views:
    559
    Ayeda
    Jan 13, 2004
  4. casioculture@gmail.com
    Replies:
    4
    Views:
    892
    Chris Uppal
    May 5, 2005
  5. KK
    Replies:
    2
    Views:
    1,133
    Big Brian
    Oct 14, 2003
  6. MuZZy
    Replies:
    7
    Views:
    2,165
    Mike Hewson
    Jan 7, 2005
  7. mera
    Replies:
    7
    Views:
    1,430
  8. beth

    HELP HELP PLEASE HELP

    beth, Oct 27, 2005, in forum: Ruby
    Replies:
    1
    Views:
    211
    Sean O'Halpin
    Oct 27, 2005
Loading...