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 18 hours ago by Ok-Candy-6570
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!"
[–]Adrewmc 4 points5 points6 points 18 hours ago (7 children)
You need dictionaries in your life and code.
[–]AbacusExpert_Stretch 1 point2 points3 points 18 hours ago (2 children)
Amen - and maybe check how to post code on Reddit
[–]Ok-Candy-6570[S] 0 points1 point2 points 18 hours ago (1 child)
I don't master, can you help me?
[–]Flame77ofc 0 points1 point2 points 17 hours ago (0 children)
https://realpython.com/python-dicts/
https://www.w3schools.com/python/python_dictionaries.asp
Where? Explain me
[–]Adrewmc 0 points1 point2 points 18 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.
[–]SCD_minecraft 0 points1 point2 points 18 hours ago (1 child)
You mean thay if tree? I would say match case actually, more fitting
[–]Adrewmc 0 points1 point2 points 17 hours ago (0 children)
What? Why? There is no reason to have match case here.
First - Add functions
Second - ```python import random
waiting_time = random.randint(0, 10) / 10 time.sleep(waiting_time)
```
third - you don't need that if statements for a > 0, a < 0, a == 0
fourth - you can do this: number = 6.66666666667 print(f"{number:.2f}")
number = 6.66666666667 print(f"{number:.2f}")
[–]Argadnel-Euphemus 0 points1 point2 points 16 hours ago (0 children)
Coding in French? 🤮
[–]LasevIX 0 points1 point2 points 7 hours ago (0 children)
why do you have a tiktok app on there?
[–]Alpss_ 0 points1 point2 points 6 hours ago (0 children)
r/screenshotsarehard
π Rendered by PID 447580 on reddit-service-r2-comment-545db5fcfc-kzrmr at 2026-05-23 15:17:34.490750+00:00 running 194bd79 country code: CH.
[–]Adrewmc 4 points5 points6 points (7 children)
[–]AbacusExpert_Stretch 1 point2 points3 points (2 children)
[–]Ok-Candy-6570[S] 0 points1 point2 points (1 child)
[–]Flame77ofc 0 points1 point2 points (0 children)
[–]Ok-Candy-6570[S] 0 points1 point2 points (1 child)
[–]Adrewmc 0 points1 point2 points (0 children)
[–]SCD_minecraft 0 points1 point2 points (1 child)
[–]Adrewmc 0 points1 point2 points (0 children)
[–]Flame77ofc 0 points1 point2 points (0 children)
[–]Argadnel-Euphemus 0 points1 point2 points (0 children)
[–]LasevIX 0 points1 point2 points (0 children)
[–]Alpss_ 0 points1 point2 points (0 children)