asd = 1
limit = "+-*/1234567890 "
while asd:
data = input("YOUR PROCESS? ")
for i in data:
if i not in limit:
print("?? ERROR ?? ")
quit()
else:
print(eval(data))
again = input("AGAIN? (E/H)")
if again == "E":
pass
else:
print("GOOD BYE... \n")
asd = 0
When I execute this code after one process, it doesn't want new value for "data". Running with first data value. How can i solve this?
it is running this for each character in the input:
print(eval(data))
again = input("AGAIN? (E/H)")
if again == "E":
pass
else:
print("GOOD BYE... \n")
asd = 0
try getting rid of the else that it is in, and putting the above block right in the while loop (after the for loop not in it)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.