繁体   English   中英

如何将整数输入到数字序列数组中?

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

例如。

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

我需要制作一个可以显示数组本身的值并将数字分配给数组索引的系统

您可以执行以下操作:声明一个列表并继续添加到列表中

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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