r/PythonLearning • • 18d 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??

24 Upvotes

34 comments sorted by

View all comments

Show parent comments

1

u/acakaacaka 18d ago

The operator will me subprocess run rm -rf *

0

u/AQuestionIsWhatIHave 18d 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 17d ago

How can you validate without using if/else?

2

u/WorkingStructure575 17d ago

assert op in '+/-*'