Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics All Together Now Cleaner Code Through Refactoring

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
seal-mask
.a{fill-rule:evenodd;}techdegree
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.

@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.