Questions about the numbering game

Asked 2 years ago, Updated 2 years ago, 14 views

Conditions

So, first of all So far, it's a code (below).

And how do we code to figure out how many numbers we've got and what we've got?

Also, where should I put .sort on the print door? (Sort is a must, so even if I put it here and there, there is an error or None.)

And Sort works well in listme, but why can't GG Sort?

import random
a = int (input('Enter a number:')
b = int (input('Enter a number: '))
c = int (input('Enter a number: '))
d = int (input('Enter a number: ')))
e = int (input('Enter a number: '))
listme = [a, b, c, d, e]
listme.sort()
gg =[random.sample(range(1, 15),5)]
gg.sort()
print('This time, winning number: ',gg)
print('Your number:',listme)
print ('number of robot 1:',[random.sample(range(1,15),5)])
print ('number of robot 2:',[random.sample(range(1, 15), 5)])
print ('number of robot 3:',[random.sample(range(1, 15), 5)])
print ('number of robot 4:',[random.sample(range(1, 15), 5)])
print ('number of robot 7:',[random.sample(range(1, 15), 5)])
print ('number of robot 8:',[random.sample(range(1, 15), 5)])
print ('number of robot 9:',[random.sample(range(1, 15), 5)])

python

2022-09-20 19:57

1 Answers

gg = [random.sample(range(1,15),5)]

g = random.sample (range(1, 15), 5)

Please change it to .

Other than that, if there is no special reason for printing, it seems better to remove [] be removed.

Additional question How do I put the +print statement into the sort? ㅜㅜ And you have to express the number of correct answers What should I do?


2022-09-20 19:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.