Python introductory tutorial - input a one-dimensional int integer array of any length

  • Use python to input a one-dimensional array of integers of any length: 
    • nums = input("请输入整数数组,用空格分隔: ")
      nums = [int(i) for i in nums.split(' ')]  # 将每个数转换为整型后输出
  •  operation result:
  • [Note] If the type is not cast, the number will exist in the form of characters.​ 

Guess you like

Origin blog.csdn.net/weixin_45100742/article/details/134559587