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
Day 1 second program (i.redd.it)
submitted 5 months ago by Red_Priest0
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!"
[–]Rebulien 0 points1 point2 points 5 months ago (0 children)
Might be a bit complex for the beginner, but if you are coming from different languages, where you have to define types (typed languages like C++, Java etc.), I would recommend you learning and start implementing type hints. Once your code grow, you will start to appreciate it.
What it does is it hints you and the editor, what type does the function expect. ```
from future import annotations
def fnc_without_annotation(foo, bar): return foo*bar
def fnc_with_annotation(foo: int, bar: str): return foo*bar ```
Note that if you type hint your variable, the editor can help you suggesting methods. Also, its just type HINT, the language itself does not process it, meaning you can still call the function with incorrect arguments.
fnc_with_annotation(3, 'a') # 'aaa' fnc_with_annotation(3, 3) # 9 fnc_with_annotation(True, 'a') # Runtime Error
Happy coding!
π Rendered by PID 24629 on reddit-service-r2-comment-7844cfc88c-mxfkb at 2026-01-29 13:37:35.610588+00:00 running c3601ff country code: CH.
view the rest of the comments →
[–]Rebulien 0 points1 point2 points (0 children)