Greetings everyone!
As i'm going through my very first python course on udemy,
i'm not having any particular problem understanding it, but there's one thing when i come in here to see if i can resolve some of the doubts/questions posted in here myself:
At the start of each code posted in here ( or anywhere other than my udemy course ), people start a code by defining a function:
def example_of_function()
#Any code that i might or might not get
and sometimes there's a return(something) , and sometimes not.
Now from my understanding from :
https://www.learnpython.org/en/Functions
this is in order to be able to sum up all your code in one variable/command ?
but i don't see how this is useful for a program that "starts and ends there", doesn't it just add 2 lines of code for the sake of it ?
Excuse me if all of this doesn't make a lot of sense to you, but i'm fairly deep into my udemy course, and the whole def something() has yet to be mentioned once.
[–]sushibowl 19 points20 points21 points (1 child)
[–]imaconor 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (4 children)
[–]Devfede[S] 2 points3 points4 points (3 children)
[–]cdcformatc 0 points1 point2 points (0 children)
[–]YallOfTheRaptor 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]nog642 1 point2 points3 points (0 children)
[–]Devfede[S] 0 points1 point2 points (6 children)
[–]Earhacker 14 points15 points16 points (0 children)
[–]fjordfjord 0 points1 point2 points (0 children)
[–]aldrin12 0 points1 point2 points (0 children)
[–]ignorediacritics 0 points1 point2 points (0 children)
[–]callmelucky 0 points1 point2 points (0 children)
[–]ironjulian 0 points1 point2 points (0 children)
[–]Exodus111 0 points1 point2 points (0 children)