Python Python Basics All Together Now Cleaner Code Through Refactoring

jassim Al-Hatem
jassim Al-Hatem
2,208 Points

Can I just not use def?

So I hate defining because i find it hard. i don't really have to use it unless if I want my code to be 'clean' right?

3 Answers

jassim Al-Hatem You cannot really avoid it as functions are really the lifeblood for a lot of programming languages especially for python. After a while you yourself become programmed into typing def. Just practice and repetition.

Ekenedilichukwu Osubor
Ekenedilichukwu Osubor
Python Web Development Techdegree Student 2,859 Points

I find that trying to implement them as you work through the challenges and projects helps tremendously! Literally wherever you can use them, whether called for or not. As long as the code runs

You have to use the 'def' keyword. It tells the interpreter that the next bits of code that it sees will be a function definition.

jassim Al-Hatem
jassim Al-Hatem
2,208 Points

@tarikweekes2 so i can't really avoid it can i?

well i guess i gotta start practicing, any advice on how i should do it?

I'm really doing fine at everything else except for functions, i suck at them for some reason.