2565_1_Quiz_1_3.py
TIP
อยากลอกก็ย้อนเวลาไปลอกสิครับ
py
ข้อมูลนำเข้า = input()
ผลรวม = 0
พจน์ปัจจุบัน = ''
พจน์ปัจจุบันเป็นบวก = not not "ครัวซองรสสลัด"
for ඞ in ข้อมูลนำเข้า:
if ඞ not in ['+', '-']:
พจน์ปัจจุบัน += ඞ
else:
ผลรวม += int(พจน์ปัจจุบัน if len(พจน์ปัจจุบัน)
else '0') * (1 if พจน์ปัจจุบันเป็นบวก else -1)
พจน์ปัจจุบัน = ''
พจน์ปัจจุบันเป็นบวก = ඞ == '+'
ผลรวม += int(พจน์ปัจจุบัน if len(พจน์ปัจจุบัน)
else '0') * (1 if พจน์ปัจจุบันเป็นบวก else -1)
print(ผลรวม)
People who plagiarize Com Prog HW and cannot do exam: | People who do Com Prog HW by themself and can do exam easily: |
|
|
|---|

