-3

instead of it being

7
3
2

How do I make it

7,3,2

This is not my output, just my input

RTStriker
  • 5
  • 3
  • sry.. check https://stackoverflow.com/questions/22641720/unpack-multiple-floats-from-input and https://stackoverflow.com/questions/7378091/taking-multiple-inputs-from-user-in-python – Suraj Rao Apr 07 '21 at 13:51
  • 1
    Not to sound rough, but that question has already been answered multiple times on the forum, it is better to exhaust research possibilities before asking. – Gevezo Apr 07 '21 at 13:56
  • Does this answer your question? [Get a list of numbers as input from the user](https://stackoverflow.com/questions/4663306/get-a-list-of-numbers-as-input-from-the-user) – Tomerikoo Apr 08 '21 at 14:02

2 Answers2

1

You could do something like this:

# 1 input request
res = input()

# split into a numbers array
numbers = res.split(',')

# remove any whitespace next to the numbers
numbers = [number.strip() for number in numbers]

These all use built in python functions, which are documented very well in the official python documentation.

tverhoef
  • 11
  • 3
0
numbers = input("enter numbers")
#takes in the input

numbers = numbers.split(",")
#splits the input into a list of the values

  

LWB
  • 426
  • 1
  • 4
  • 16