0
import random


while True:
    dice_number = random.randint(1, 6)

    print('You rolled ' + str(dice_number))

    print("Do you wish to continue? [Y/n]" )
    if input() == 'Y' or 'y':
        pass
    else:
        break

I just wasted half an hour trying to figure this out, still don't know what I did wrong. Can anyone help me please

Filip
  • 855
  • 2
  • 18
  • 38

1 Answers1

1

You can't do or == 'y'. You have to put the whole logic expression again. Like this:

import random


while True:
    dice_number = random.randint(1, 6)

    print('You rolled ' + str(dice_number))

    print("Do you wish to continue? [Y/n]" )
    a = input()

    if a == 'Y' or a == 'y':
        pass
    else:
        break
Eduardo Soares
  • 992
  • 4
  • 14