Functions and Built-in Functions

Function:

  • All functions start with reserved keyword 'def'
  • All functions' definition ends with ':'
  • By convention, indentation in Python is 4 spaces
  • To write a comment, use '#'
  • Every function returns a value. If there is no return statement, Python will return the special value None
Note:
print('hello ' + 'Huy') is the same as print('hello', 'Huy')
def bye():
    print('Goodbye') # print Goodbye and None

Comments

Popular posts from this blog

Conditional Statements

6.00.1x - Week 2

Basic Machine Architecture