Why?

Why this technology is relevant and what the scope.

Python is a general-purpose and high-level programming language. You can use Python for developing desktop GUI applications, websites, and web applications. Also, Python, as a high-level programming language, allows you to focus on the core functionality of the application by taking care of common programming tasks

Take-Away Skills

After following this resource what you will learn.

Syllabus

Summary of what learn to get started.

The content

Details about the technology and learning materials.

Python Syntax

Hello World!

print("This line will be printed.")
# This line will be printed.

Python is a very simple language and has a very straightforward syntax. The simplest directive in Python is the "print" directive - it simply prints out a line

Built-in Data Types

Variables can store data of different types, and different types can do different things.

Python has the following data types built-in by default, in these categories:

Data types

String Literals

String literals in python are surrounded by either single quotation marks or double quotation marks.

'hello' is the same as "hello".

You can display a string literal with the print() function:

Creating Variables

x = 5
y = "John"
print(x)
print(y)
# 5
# john

List, Tuple, Dictionary

Python Conditions and Loops

Conditions

if

An "if statement" is written by using the if keyword.

Example:

a = 33
b = 200
if b > a:
  print("b is greater than a")

elif

The elif keyword is pythons way of saying "if the previous conditions were not true, then try this condition".

Example:

a = 33
b = 33
if b > a:
  print("b is greater than a")
elif a == b:
  print("a and b are equal")

else

The else keyword catches anything which isn't caught by the preceding conditions.

Example:

a = 200
b = 33
if b > a:
  print("b is greater than a")
elif a == b:
  print("a and b are equal")
else:
  print("a is greater than b")

Loops

Python has two primitive loop commands:

With the while loop we can execute a set of statements as long as a condition is true.

Print i as long as i is less than 6:

i = 1
while i < 6:
  print(i)
  i += 1

A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).

This is less like the for keyword in other programming languages and works more like an iterator method as found in other object-orientated programming languages.

With the for loop, we can execute a set of statements, once for each item in a list, tuple, set, etc.

fruits = ["apple", "banana", "cherry"]
for x in fruits:
  print(x)

Python functions

Creating and calling a function

def my_function():
  print("Hello from a function")

my_function()
# Hello from a function

<aside> 👶 Level: Beginner

</aside>

<aside> 💼 Career Path: ‣

</aside>

Top links

3.7.5rc1 Documentation

Automate the Boring Stuff with Python

Free courses

Free Python Tutorial - Introduction To Python Programming

Communities in Kerala

TinkerHub Foundation - Creating talents with emerging technology skills