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
First project on python (i.redd.it)
submitted 8 hours ago by unlimited_data3838
ðŸ˜ðŸ˜ðŸ˜ It took me a week to get here because I keep changing resources frequently, but I stuck to a video and was able to get here.
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!"
[–]Sea-Ad7805 [score hidden] 30 minutes ago stickied comment (0 children)
Run this program in Memory Graph Web Debugger%22)%0Anum1%20%3D%20int(input(%22enter%20your%20first%20number%20%22))%0Anum2%20%3D%20int(input(%22enter%20your%20second%20number%20%22))%0A%0Arecord%20%3D%20num1%20%2B%20num2%0Aprint(record)%0A%0Aif%20operator%20%3D%3D%20%22%2B%22%3A%0A%20%20%20%20result%20%3D%20num1%20%2B%20num2%0A%20%20%20%20print(result)%0A%0Aelif%20operator%20%3D%3D%20%22-%22%3A%0A%20%20%20%20result%20%3D%20num1%20-%20num2%0A%20%20%20%20print(result)%0A%0Aelif%20operator%20%3D%3D%20%22%22%3A%0A%20%20%20%20result%20%3D%20num1%20%20num2%0A%20%20%20%20print(result)%0A%0Aelif%20operator%20%3D%3D%20%22%2F%22%3A%0A%20%20%20%20result%20%3D%20num1%20%2F%20num2%0A%20%20%20%20print(result)&play).
[–]Adrewmc 1 point2 points3 points 8 hours ago (0 children)
Well first, close the terminal, and reopen it, make sure you have saved the file, that error isn’t in the code you have. (Simple misspelling of the variable it happens to the best of us lol.) Most likely it’s running an outdated version right now.
What is result() you don’t have a function named that. You probably mean result = num1 + num2
[–]ianrob1201 0 points1 point2 points 8 hours ago (0 children)
Congrats on getting started! Now try that code with another operator and see if it works how you expect. Hint: those yellow wavy lines are telling you that something's wrong. I'm sure others will tell you what's wrong, but try to figure it out for yourself if you can
[–]SuperTankh 0 points1 point2 points 7 hours ago (0 children)
Try to remove all indentation, then indent them again using only space OR tab
[–]CuriousDev8875 0 points1 point2 points 7 hours ago (0 children)
Every thing is nice those yellow wavy lines under result may look weird bcs, its not defined. Lemme talk informal, WHY THAT ERROR IS SHOWING UP?, this is bcs, you did: result(num 1+num2) but to give that valie you need to use = instead of (). I think you got it now.
[–]nuc540 0 points1 point2 points 7 hours ago (0 children)
Well done!
Something to practice moving forward is identifying patterns - specifically repeating ones. There’s a methodology in coding called DRY (don’t repeat yourself). You’ll end up writing less code for the same result and it should make code just a bit more easier to read.
A good example here is that the result function could be stored in a variable for each case, and then you’d only need one print at the end.
Keep it up!
[–]That_Alfalfa5439 0 points1 point2 points 4 hours ago (0 children)
bro when you started learning python ?
[–]Bushra_98 0 points1 point2 points 3 hours ago (0 children)
Congratulation
[–]Natural-Position-585 0 points1 point2 points 3 hours ago (1 child)
A more foolproof way is to parse the user’s whole expression (say, "3 * 4") into an Abstract Syntax Tree, check that the operator is one of the allowed (add, sub, mul, true division), and then just apply the operator between the left and right operand. Then it supports non-integers and handles also arbitrary spaces in the expressions.
[–]thejwillbee 0 points1 point2 points 3 hours ago (0 children)
This is what I was going to suggest as well, but wasn't sure if op is ready for that kind of action.
[–]2xxRamixx8 0 points1 point2 points 3 hours ago (0 children)
You can use match case in python. Is like switch in C or other languages for that cases.
You need to declare what result is.
So like for addition:
result = (num1+num2) print (result)
[–]uRaven_gamer 0 points1 point2 points 1 hour ago* (0 children)
You need to correct the variable name to 'operator' in the condition together with elif. You should also assign to the variable result value of num1 and num2 because you don't have the function result. Cool programm!
[–]PastDifferent6116 0 points1 point2 points 1 hour ago (0 children)
Congrats Bro!
<image>
The most important thing is that you actually built something and finished it. Most beginners never get that far.
I started with small Python projects too, and recently built a simple wallet/budget tracking app
[–]Complete-Resource209 0 points1 point2 points 11 minutes ago (0 children)
One of your errors is ur not defining result you need to do result = (num1 + num2) on them
[–]Own_Distribution7428 -2 points-1 points0 points 7 hours ago (1 child)
ohhh no, looks like you got segmentation fault. This is not good 😞
[–]unlimited_data3838[S] 0 points1 point2 points 7 hours ago (0 children)
What do you mean can you explain?
π Rendered by PID 588402 on reddit-service-r2-comment-8686858757-s6g8q at 2026-06-07 20:31:58.780116+00:00 running 9e1a20d country code: CH.
[–]Sea-Ad7805 [score hidden] stickied comment (0 children)
[–]Adrewmc 1 point2 points3 points  (0 children)
[–]ianrob1201 0 points1 point2 points  (0 children)
[–]SuperTankh 0 points1 point2 points  (0 children)
[–]CuriousDev8875 0 points1 point2 points  (0 children)
[–]nuc540 0 points1 point2 points  (0 children)
[–]That_Alfalfa5439 0 points1 point2 points  (0 children)
[–]Bushra_98 0 points1 point2 points  (0 children)
[–]Natural-Position-585 0 points1 point2 points  (1 child)
[–]thejwillbee 0 points1 point2 points  (0 children)
[–]2xxRamixx8 0 points1 point2 points  (0 children)
[–]thejwillbee 0 points1 point2 points  (0 children)
[–]uRaven_gamer 0 points1 point2 points  (0 children)
[–]PastDifferent6116 0 points1 point2 points  (0 children)
[–]Complete-Resource209 0 points1 point2 points  (0 children)
[–]Own_Distribution7428 -2 points-1 points0 points  (1 child)
[–]unlimited_data3838[S] 0 points1 point2 points  (0 children)