Skip to content

Instantly share code, notes, and snippets.

@HarunMbaabu
Created December 27, 2021 15:05
Show Gist options
  • Select an option

  • Save HarunMbaabu/d68d2120ae3cdedaf070c9e2f5b320ca to your computer and use it in GitHub Desktop.

Select an option

Save HarunMbaabu/d68d2120ae3cdedaf070c9e2f5b320ca to your computer and use it in GitHub Desktop.

Python is an interpreted, high-level language created by Guido van Rossum and released in 1991. It is dynamically typed and garbage collected.

Python programs have the extension .py and can be run from the command line by typing python file_name.py.

Probably its most noticeable characteristic is its use of significant white space to delimit code blocks, instead of the more popular {} symbols.

End-of-line semicolons (;) are optional and usually not used in Python.

Python becomes the best solution in many domains from web applications, data analysis, data science, machine learning, and AI.

Simple python function:

Functions are defined using the def keyword.

# functions
def allowed_to_drive(age):
  if age >= 21:
    return True
  else:
    return False

print(allowed_to_drive(42)) # True
print(allowed_to_drive(12)) # False 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment