Calculator With Fifty Cases
# my_first_calculator.py by AceLewis # TODO: Make it work for all floating point numbers too if 3/2 == 1: # Because Python 2 does not know maths input = raw_input # Python 2 compatibility print("Welcome to this calculator!") print("It can add, subtract, multiply and divide whole numbers from 0 to 50") num1 = input("Please choose your first number: ") sign = input("What do you want to do? +, -, /, or *: ") num2 = input("Please choose your second number: ") if num1 == 0 and sign == '+' and num2 == 0: print("0+0 = 0") if num1 == 0 and sign == '+' and num2 == 1: print("0+1 = 1") if num1 == 0 and sign == '+' and num2 == 2: print("0+2 = 2") if num1 == 0 and sign == '+' and num2 == 3: print("0+3 = 3") if num1 == 0 and sign == '+' and num2 == 4: print("0+4 = 4") if num1 == 0 and sign == '+' and num2 == 5: print("0+5 = 5") if num1 == 0 and sign == '+' and num2 == 6: print("0+6 = 6") if num1 == 0 and sign == '+' and num2 == 7: print("0+7 = 7") if num1 == 50 and sign == '*' and num2 == 38: print("50*38 = 1900") if num1 == 50 and sign == '*' and num2 == 39: print("50*39 = 1950") if num1 == 50 and sign == '*' and num2 == 40: print("50*40 = 2000") if num1 == 50 and sign == '*' and num2 == 41: print("50*41 = 2050") if num1 == 50 and sign == '*' and num2 == 42: print("50*42 = 2100") if num1 == 50 and sign == '*' and num2 == 43: print("50*43 = 2150") if num1 == 50 and sign == '*' and num2 == 44: print("50*44 = 2200") if num1 == 50 and sign == '*' and num2 == 45: print("50*45 = 2250") if num1 == 50 and sign == '*' and num2 == 46: print("50*46 = 2300") if num1 == 50 and sign == '*' and num2 == 47: print("50*47 = 2350") if num1 == 50 and sign == '*' and num2 == 48: print("50*48 = 2400") if num1 == 50 and sign == '*' and num2 == 49: print("50*49 = 2450") if num1 == 50 and sign == '*' and num2 == 50: print("50*50 = 2500") print("Thanks for using this calculator, goodbye :)")
A screenshot shows an absurd Python calculator that handles arithmetic by writing a separate if statement for each possible input, with only a few cases visible at the top and a long jump to cases near 50 × 38–50. The joke is that the program is comically overengineered instead of using normal arithmetic, matching the caption’s comparison to generics in Go as something ugly but impressive in scale. EN: A screenshot shows an absurd Python calculator that handles arithmetic by writing a separate if statement for each possible input, with only a few cases visible at the top and a long jump to cases near 50 × 38–50. The joke is that the program is comically overengineered instead of using normal arithmetic, matching the caption’s comparison to generics in Go as something ugly but impressive in scale.
- @ithueti / 1668 2019-11-16
- Type
- image
- Size
- 390×800 · 68.0 KiB
- Mood
- absurd, sarcastic
- Language
- en
- Added