Whenever I try appending numbers from my input to my list, it goes outside one of the brackets instead of inside the two brackets
Is there a way to only have one pair of brackets instead of two?
Also I am trying to add random numbers between 1-3 and i get,
[[2, 1, 3]]
How can you create random numbers in the tenths decimal place
My Code,
import random
array = []
nums = random.sample(range(1, 4), 3)
array.append(nums)
print(array)
for x in range(2):
nums = int(input("what are your numbers "))
array.append(nums)
print(array)
I get,
[[2, 1, 3]]
what are your numbers 3
[[2, 1, 3], 3]
what are your numbers 2
[[2, 1, 3], 3, 2]
Process finished with exit code 0
Aucun commentaire:
Enregistrer un commentaire