I want to make a calculator in Python, how would have multiple inputs?
10/22/2018 7:58:17 PM
Tyler5 Answers
New Answervar = input().split(" ") then you get a list of all inputs but the must be seperated with a space
you can also change the split("x") then you can seperate them with x instead of space you're welcome :)
You can also take each input separately by looping and saving the results in a list, for example: L=[] while True: number=input() if not number: break if number.isdigit(): L.append(int(number)) Like that you are flexible in how many inputs you take - it stops when the user just presses enter. (Taking input with a loop works well in real life, not on sololearn though. ;-))
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message