Repeat list

Asked 2 years ago, Updated 2 years ago, 54 views

import random
Q = int(input('drawing lots!') Please enter a quota.')


numbers = list(range(1, Q + 1))
R1 = random.choice(numbers)
print('{} and''.format.(R1))
numbers.remove(R1)
R2 = random.choice(numbers)
print('It's the same pair as '{}' format(R2))
numbers.remove(R2)

The invalid syntax error appears, but I don't know what's wrong. I don't know what to do if I want to repeat picking and erasing numbers.

python3 list infinite function

2022-09-22 15:48

1 Answers

Q = int(input() drawing lots!! Please enter a quota.')

One is missing

Q = int(input() drawing lots!! Please enter a quota.'))

Correct that.


2022-09-22 15:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.