How to put from 1 to the substituted number in the list[] value?

Asked 2 years ago, Updated 2 years ago, 45 views

제가 순서 정하기 비슷한것을 만드려고 합니다.

If the user enters a value of 5,

Numbers from 1 to 5 come out randomly and check your rank.

I'd like to write a code to delete the rank from the list [ ].

list[ ] Leave the list value blank like this and take the int(input() value as 7

Can the value of the list be list[1, 2, 3, 4, 5, 6, 7]?

The code I was writing is

import random
print ('To decide the order')
print('')
list1 = []
O = random.choice(K)
Q = int('input(') Say how many.'))

And if a number comes from a list [ ], can you eliminate that number from a list [ ]?

The question is a bit awkward, but I'd appreciate it if you could answer it.

python list

2022-09-21 21:19

1 Answers

I think the sample below will be the answer to the necessary questions.

numbers = list(range(1, 11)) #1 to generate numbers from 10
Remove numbers.remove(3) #3
print(numbers)

[1, 2, 4, 5, 6, 7, 8, 9, 10]


2022-09-21 21:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.