How to input a list that contains integer numbers on which arithmetic operations such as +,*,-,/ can be performed. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How to input a list that contains integer numbers on which arithmetic operations such as +,*,-,/ can be performed.

X=list(input("Enter a list:"))...this code enters a string...but I need numbers tat could be added or subtracted

30th Jul 2016, 2:20 PM
Karthick M
Karthick M - avatar
2 Antworten
+ 1
Use int() function. so your code will be : X=list(int(input("Enter a list:")))
30th Jul 2016, 6:07 PM
Alireza M
Alireza M - avatar
0
@Ali Reza Sorry bro I tried it...it's not working!
30th Jul 2016, 7:06 PM
Karthick M
Karthick M - avatar