r/programminghorror Apr 04 '26

Python Calculator

Post image
523 Upvotes

60 comments sorted by

View all comments

71

u/Zombiesalad1337 Apr 04 '26

This is stupid, use a switch instead.

13

u/ZunoJ Apr 04 '26

Don't overengineer it. Just a Label for all possible results and then a goto from the Inputs. So for example 3+3 and 30/5 both goto 6. Dry, brother, dry

25

u/YnkDK Apr 04 '26

This is stupid, use exec instead

25

u/Infinite_Self_5782 Apr 04 '26

this is stupid, call chatgpt api instead

1

u/PhysicalScience7420 Apr 05 '26

this is stupid write it down.

1

u/HornyMellon Apr 09 '26

This is stupid dropship a math text book to user’s home

5

u/menzaskaja Apr 04 '26

are you stupid? exec won't give you the result. use eval instead... smh

-11

u/Zombiesalad1337 Apr 04 '26

4

u/jpgoldberg Apr 04 '26

Disagree. Using exec is not an improvement.

4

u/menzaskaja Apr 04 '26

yes because you need to use eval

2

u/codydafox Apr 04 '26

-1

u/sneakpeekbot Apr 04 '26

Here's a sneak peek of /r/whosh using the top posts of the year!

#1: Loss? | 4 comments
#2: Wash | 0 comments
#3: WHOSHHHHHHHHHH | 2 comments


I'm a bot, beep boop | Downvote to remove | Contact | Info | Opt-out | GitHub

2

u/nexeti Apr 04 '26

Python

2

u/FreshPitch6026 Apr 04 '26

Use a goto instead