May-12-2017, 05:59 PM
Hey, I just joined this forum and I have a controlled assessment which we're allowed to use the internet for help and my question is, how would I allow one player to 'ROLL' the dice and then allow the second player to 'ROLL' the dice. It needs to track both players scores seperately and add on what number they rolled to what they previously rolled. What it does it allows the user to roll the dice and after 6 seconds generates a random number between 1-6, after this it
print("Alright, please type 'ROLL' to roll the dice") def rollDice(player): roll = input("") while True: if roll != "ROLL": print("Invalid input, please try again (case sensitive)") break else: print("Rolling.") time.sleep(2) #pauses script for 2s before continuing print("Rolling..") time.sleep(2) print("Rolling...") time.sleep(2) dice_num=random.randint(1,6)#picks random number between 1-6 p1score = dice_num print(namep1,", you're now on space",p1score) if p1score or p2score == 49: playerWin() return def main(): rollDice(namep1) rollDice(namep2) main()