+ 1
Struggling with python😓....any tips on how to master this language?
5 Réponses
+ 1
its used to declare functions.
in other languages we make functions using the syntax:
function functionName(){
// do something
}
in python the syntax is different but does the same thing:
def functionName:
// do something
you'll also notice python is a language that doesn't require a semicolon(;) at the end of a line. instead, it uses spacing to break out of functions so be sure to add an extra line or two after the function so the compiler doesn't trip up.
+ 9
def isn't a function. Python has built-in functions like print() but there are functions defined by the user that aren't built into python and they are created by the def keyword. Read more about def here:
https://www.tutorialspoint.com/python/python_functions.htm
https://stackoverflow.com/questions/18711139/what-is-a-def-function-for-python#18711172
I would recommend practicing the concepts you learn as much as you can; until you understand them before moving on to the next concepts. Some concepts will be harder to grasp than others so be patient with yourself and move at your own speed.
Don't learn from one place. Other learning communities may explain certain concepts better than others so it's always best to keep the range of the places you learn from wide
+ 1
thnk u so much👍
0
what part are you struggling with?
0
what is the purpose of def function?