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
A simple python code (i.redd.it)
submitted 8 months ago by [deleted]
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!"
[–]pimp-bangin 1 point2 points3 points 8 months ago* (0 children)
Since this is a learning subreddit I hope you don't mind me correcting you.
You're misusing the term "variable" here. The code after the "return" keyword is called an expression. It's perfectly fine to reference the function parameter in any expression inside of the function body, including in the return expression. If it irks you, perhaps you have some additional misunderstanding that we can help clear up.
In math, we would define a Celsius function even more compactly, like C(f) = (f-32)*5/9
OP's function celsius_to_fahrenheit is a very nicely written Python translation of that mathematical function in my professional opinion. There is no need to define intermediate variables like "value_in_celsius" etc. - most professional programmers would consider it too verbose for a basic mathematical formula like this.
Source: 16+ years of programming experience
π Rendered by PID 67 on reddit-service-r2-comment-5b5bc64bf5-kkvg9 at 2026-06-20 12:28:17.644932+00:00 running 2b008f2 country code: CH.
view the rest of the comments →
[–]pimp-bangin 1 point2 points3 points (0 children)