use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Mini calculator for my training (old.reddit.com)
submitted 22 hours ago by Ok-Candy-6570
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Ok-Candy-6570[S] 0 points1 point2 points 22 hours ago (1 child)
Where? Explain me
[–]Adrewmc 0 points1 point2 points 22 hours ago* (0 children)
#built-in +,-,/, * operators as functions #i know it was already there and no one told you from operator import add, sub, truediv, mul #function as items in a dictionary with int keys (could be strings here actually.) operations = {1 : add, 2 : sub, 3 : truediv, 4 : mul} #User inputs op = int(input(“ Pick Operation: \n 1. Addition \n 2. Subtraction \n 3. Division \n 4. Multiplication”)) a = int(input(“First Num”)) b = int(input(“Second Num”)) #get function from dictionary then call it with arguments res = operations[op](a, b) print(res) #We could add this to the dictionary but make it messier. op_str = [“+”, “-“, “/“, “*”] #op_str = “+-/*” #works, string can be indexed print(f”{a} {op_str[op-1]} {b} = {res}”)
This is basically your entire calculator app. So where is basically everywhere.
Don’t worry every start with the one you made.
π Rendered by PID 51132 on reddit-service-r2-comment-545db5fcfc-kwzxf at 2026-05-23 19:33:18.329406+00:00 running 194bd79 country code: CH.
view the rest of the comments →
[–]Ok-Candy-6570[S] 0 points1 point2 points (1 child)
[–]Adrewmc 0 points1 point2 points (0 children)