Python Essentials Classroom Series – 08/Jul/2021

Guido Van Rossum

  • Guido has created the language of python Preview
  • Python is the opensource language.
  • Python has various implementations and the most popular one is cpython. Refer Here
  • There are other implemenations of python
    • Jython
    • IronPython
  • In python all the new features of python are created as python enhancement proposals (PEP) Refer Here
  • Zen of python Refer Here
  • Python style guide Refer Here

Naming Conventions

  • Generally We have the following Naming Conventions
    • Pascal Casing
    MyList
    YourListItem
    
    • Camel Casing
    myList
    yourListItem
    
    • Snake Casing
    my_list
    your_list_item
    
  • In python to Name variables we use snake casing
  • Note: When naming variable prefer readable name
prefer 
    remaider = 0 over r = 0
    index = 0 over i = 0

Python Program Execution (Introduction) & Debugging using Visual Studio Code

  • Python executes the instructions line by line.
  • Using Visual Studio Code we can take control of execution of python program.
  • We need to define a break point which is a point from which we can execute the code
  • Now use the Run -> Start Debugging Option
  • As of now we have looked into
    • Toggle Breakpoint -> F9
    • Start Debugging -> F5
    • Step Over -> F10

Indentation in Python

  • Indentation is an extermely important concept of python because without proper indendation the Python code will not execute
  • In simple terms indendtation refers to whitespaces before a statement.
  • All the code in python block will generally have four spaces to start the statements
for index in range(10, 1000):
    for prime_index in range(2,index):
        if index%prime_index == 0:
            print(f"{index} is not prime")
            break
    else:
        print(f"{index} is prime")

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin