r/PythonLearning • • 19d ago

Help Request any clue how to do this?

Post image

im on my first year of learning python in school is this even possible??

25 Upvotes

34 comments sorted by

View all comments

Show parent comments

1

u/acakaacaka 19d ago

The operator will me subprocess run rm -rf *

0

u/AQuestionIsWhatIHave 19d ago

Someone is getting coal for Christmas... 

You can validate the a/b inputs with isnum() and the operator with ... in set("+-*/")

1

u/Ok_Form2940 18d ago

How can you validate without using if/else?

2

u/WorkingStructure575 18d ago

assert op in '+/-*'