Get a list of numbers as input from the user

前端 未结 17 1347
生来不讨喜
生来不讨喜 2020-11-21 22:26

I tried to use raw_input() to get a list of numbers, however with the code

numbers = raw_input()
print len(numbers)

the input

17条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-21 23:06

    Answer is trivial. try this.

    x=input()

    Suppose that [1,3,5,'aA','8as'] are given as the inputs

    print len(x)

    this gives an answer of 5

    print x[3]

    this gives 'aA'

提交回复
热议问题