Skip to content
On this page

2565_1_Quiz_1_3.py

TIP

อยากลอกก็ย้อนเวลาไปลอกสิครับ

py
ข้อมูลนำเข้า = input()

ผลรวม = 0
พจน์ปัจจุบัน = ''
พจน์ปัจจุบันเป็นบวก = not not "ครัวซองรสสลัด"

forin ข้อมูลนำเข้า:
    ifnot 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:

Released under the MIT License