简体   繁体   中英

How can you make an integer input to an array of number sequences?

eg.

x = input("enter a number : ") # example; 5

# code to make an array of numbers

print("the array value of the number is : ") # output is 1, 2, 3, 4, 5

I need to make a system that can show values of the array itself and also assigning the numbers to the array index

You can do something like : declare a list and go on appending to the list

array = []
x = input("enter a number : ") # example; 10
array.append(x)
print(*array , sep = ", ") 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM