Table of Contents

, , , , , , , , ,

About the Club

Python Club Topics - Syntax

Questions

  1. What is syntax?
  2. Why is this important?

Syntax

  1. Syntax is the rule set for a particular language
  2. Indentation is VERY important in Python
    1. Indentation is used to determine when the code is inside a new contruct
    2. This is easier than using semicoluns ( eg. ; )

Comments

  1. Comments are available in 2 forms
    1. Number/Pound/Hash tag ( # ) at the beginning of the comment
      1. Normally used to create one-line comments or to disable the interpretation of some code
        # this is a comment
        print("Hello world!") # This is another comment
        # print("blah blah blah")
    2. Tripple quotes ( ''' or “”“ )
      1. Normally used to create multi-line comments to explain complex code
        """ This is a multi-line comment that
            explains what come complex code
            is doing that can't be done in
            1 or 2 lines"""
        print("Hello world!")

Display Messages on the Screen

  1. print() function
    print('Hello world!')