0% found this document useful (0 votes)
2 views

Python-4

This document provides an introduction to Python, covering key concepts such as variables, data types, conditionals, loops, functions, and file handling. It emphasizes the importance of self-explanatory variable names and comments for clarity, as well as dynamic typing and shorthand operators in Python. Additionally, it includes examples and resources for further learning.

Uploaded by

janavikadam124
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python-4

This document provides an introduction to Python, covering key concepts such as variables, data types, conditionals, loops, functions, and file handling. It emphasizes the importance of self-explanatory variable names and comments for clarity, as well as dynamic typing and shorthand operators in Python. Additionally, it includes examples and resources for further learning.

Uploaded by

janavikadam124
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Introduction to Python

Session 4
What will you learn ?

• Introduction • Literals
• Introduction to Data Sets • Conditionals
• Concepts of Variables, Iterations & • Loops
Filtering • Functions
• Data Types • Lists & Tuples
• Sanity of Data • Sets & Dictionaries
• Introduction to Complex Data Types • File Handling
• Hands – On Python • Object Oriented Programming
Variables

Variables need to be self explanatory


Variables need to have comments for better relations &
understanding

Ex- 1

Two brothers have a bank balance of 100,000 & 2500,000 respectively, They also have a net
outstanding or 125000 & 3500000 Kindly write a script to find their net final value
Variables

Variables have dynamic typing in python

Ex. Ex.

A=10 A=10
print(type(A) print(type(A)
A=“India” A=A/2
Print(type(A) print(type(A)
A=“India”
Print(type(A)
Variables

Key words cannot be used for variable initialization

Ex. Ex.
x,y=1,2
for=7’ print(x,y)
print(for) x,y=y,x
print(x,y)
Variables

Deleting the variables

Ex.

A=10
print(A)
del A
print(A)
Variables

Shorthand operators

Count=0 Count=0 Count=0 Count=10 Count=10


Count=Count+1 Count+=1 Count-=1 Count*=1 Count/=2
Count=Count+1 Count+=1 Count-=1 Count*=1 Count/=2
Count=Count+1 Count+=1 Count-=1 Count *=1 Count /=2
Count=Count+1 Count+=1 Count-=1 Count *=1 Count /=2
Count=Count+1 Count+=1 Count-=1 Count*=1 Count /=2
print(Count) print(Count) print(Count) print(Count) print(Count)
Variables

Special operators

print(“Institute” in “SIES College of Management Studies”)

print(‘SIES’ in “SIES College of Management Studies”)


Variables

Special operators

x=5
print(x<5<10)
print(10>x<19)
print(10>x*5<19)
print(10>x/2<19)
print(10>x**3<19)
print(5==x>4)
Variables

Escape Characters & Types of Quotes

print('it's a beautiful day') print("Hi students ")


print('it\'s a beautiful day') print('are you enjoying python')

print(“it's a beautiful day”) print("Hi students\n are you enjoying python")


print(‘it\”s a beautiful day’) print('are you enjoying python')
Variables

Escape Characters & Types of Quotes

x1='this is the first line’


y1='this is the second line’
z1= '''first line
second line
third line’‘’
print(x1)print(y1)print(z1)
Variables

Comment for more than 1 line

‘’’x1='this is the first line’


y1='this is the second line’
z1= '''first line
second line
third line’‘’
print(x1) print(y1)print(z1)’’’
Functions in Strings
Resources

• https://drive.google.com/drive/my-drive

• https://www.python.org/

• https://www.python.org/psf/

• http://www.replit.com/

• https://docs.replit.com/tutorials/introduction-to-the-repl-it-ide

You might also like