SlideShare a Scribd company logo
1 of 12
Lecture 1:- print, id, type, basic data type (integer, float, string)
print('this is first python class') #this is first python class
print("hello student");print("welcome at inception") #hello student #welcome at inception
# This is single line comment
'''
this is multiline comment
welcome at inception.
'''
a=10
print(type(a)) #<class 'int'>
b=12.2
print(type(b)) #<class 'float'>
c='hello'
print(type(c)) #<class 'str'>
d="hello"
print(type(d)) #<class 'str'>
e='''hello
how are you'''
print(type(e)) #<class 'str'> #used for multiline string
f="""hello
how are you"""
print(type(f)) #<class 'str'> #used for multiline string
g=10
print(type(g)) #<class 'int'>
#id of a and e is equal because both refer to same value
#so value are stored at one place rather than multiple place
#same concept are used in facebook for photo storing
print(id(a)) #1522298624
print(id(g)) #1522298624
print(id(b)) #2240465414760
print(id(c)) #2321848675664
print(id(d)) #2321848675664
print(id(e)) #2321848802664
print(id(f)) #2321848802664
n=input("Enter any number")
print(type(n))
#Enter any number11
#<class 'str'>
n=int(input("Enter any number"))
print(type(n))
#Enter any number12
#<class 'int'>
n=float(input("Enter any number"))
print(type(n))
#Enter any number2.3
#<class 'float'>
a=10
b=20
print(id(a)==id(b))
#False
c=10
print(id(a)==id(c))
#True
Lecture 2:- multi datatype declaration, input, eval, sqrt, fabs, comparison operators,if,else
#this is single line comment
a=b=10
print(a,b)
#10 10
#swap of two number
a,b=10,20
a,b=b,a
print("a:",a,"b:",b)
#a: 20 b: 10
#swap of two number
a=eval(input("enter first number"))
b=eval(input("enter first number"))
x,y=a,b
a,b=b,a
print("value of", x, "and", y, "after swap",a,b)
#enter first number10
#enter first number20
#value of 10 and 20 after swap 20 10
#temperature in Celsius and Fahrenheit
c=eval(input("enter temperature in Celsius"))
f=((9/5)*c)+32
print("temperature in Celsius", c,"is",f,"in Fahrenheit")
#enter temperature in celcius37
#temperature in Celsius 37 is 98.60000000000001 in Fahrenheit
c=(f-32)*(5/9)
print("temperature in fahernite",f,"is",c, "in celcius")
#temperature in fahernite 98.60000000000001 is 37.00000000000001 in celcius
print(9/5) #1.8
print(9//5) #1
import math
a=math.sqrt(4)
print(a) #2.0
from math import sqrt
a=sqrt(4)
print(a) #2.0
#find hypotenuse of triangle
b=eval(input("enter base of triangle"))
h=eval(input("enter height of triangle"))
import math
hy=math.sqrt(h*h+b*b)
print("hypotenuse of triangle with height",h,"and base",b,"is",hy)
#enter base of triangle3
#enter height of triangle4
#hypotenuse of triangle with height 4 and base 3 is 5.0
#find hypotenuse of triangle
from math import sqrt
hy=sqrt(h*h+b*b)
print("hypotenuse of triangle with height", h, "and base",b,"is",hy)
#hypotenuse of triangle with height 4 and base 3 is 5.0
from math import fabs
a=fabs(-4)
print(a) #4.0
#comparison operators
a=eval(input("enter first number:"))
b=eval(input("enter second number:"))
if(a<b):
print("a=",a,"is less than b=",b)
if(a>b):
print("b=",b," is less than a=",a)
if(a==b):
print("b=",b," is equal to a=",a)
if(a<=b):
print("b=",b," is less or equal to a=",a)
if(a>=b):
print("b=",b," is greater than or equal to a=",a)
if(a!=b):
print("b=",b," is not equal to a=",a)
#b= 10 is less than a= 50
#b= 10 is greater than or equal to a= 50
#b= 10 is not equal to a= 50
Lecture 3: String, id, while, end
print('He said,"Ram is honest"')
#He said,"Ram is honest"
#string
s='hello'
print(s,type(s)) #hello <class 'str'>
s1="hello"
print(s1,type(s1)) #hello <class 'str'>
s2='''hello'''
print(s2,type(s2)) #hello <class 'str'>
s3="""hello"""
print(s3,type(s3)) #hello <class 'str'>
s="hello inception"
print(s[3:5]) #lo
print(s[6:15]) #inception
print(s[-1:]) #n
s="Hello Inception"
#slicing of string
s="Hello Inception"
print(s[6:-1])
#'Inceptio'
print(s[-1:-10])
#'' print nothing
print(s[-1:-9])
#'' print nothing
print(s[-9:-1])
#'Inceptio'
print(s[14:0])
#'' print nothing
#while loop
i=1
while(i<=10):
print(i,end=" ") #print value in one line
i=i+1
else:
print("bye")
#perfect square
from math import sqrt
a=eval(input("enter any number"))
b=sqrt(a)
if(a==b*b):
print(a,"is a perfect square")
else:
print(a,"is not perfect square")
#enter any number25
#25 is a perfect square
Lecture 4: for loop, and, or
for i in range(0,5):
print(i, end=" ")
#0 1 2 3 4
for i in range(0,10,2):
print(i,end=" ")
#0 2 4 6 8
for i in range(10,0,-2):
print("n",i,end=",")
#10,8,6,4,2
a=10
b=20
c=10
if(a!=c) or (b<a):
print('hi')
else:
print("hello")
#hello
#largest of three number
a=eval(input("enter first no."))
b=eval(input("enter second no."))
c=eval(input("enter third no."))
if(a>b) and (a>c):
print(a,"is largest")
else:
if(b>a) and (b>c):
print(b,"is largest")
else:
print("c is largest")
#leap year
y=eval(input("Enter year"))
if (y%4==0):
if(y%100==0):
if(y%400==0):
print("leap year")
else:
print("not leap year")
else:
print("leap year")
else:
print("not leap year")
#check number power of 3
n=eval(input("enter number"))
while(n%3==0):
n=n/3
if(n==1):
print("power of 3")
else:
print("not power of 3")
Lecture 5: for loop break, continue and pass
# check if an integer is power of another integer
n1=eval(input("Enter integer"))
n2=eval(input("ckeck for integer"))
while(n1%n2==0):
n1=n1/n2
if(n1==1):
print("power of ",n2)
else:
print("not power of ",n2)
#break demonstration
for i in range(14):
if(i==5):
break
print(i)
print("good bye")
#continue demonstration
for i in range(14):
if(i==5):
continue
print(i)
print("good bye")
#pass demonstration
for letter in 'python':
if (letter=='h'):
pass
print("this is pass")
print("current letter",letter)
print("bye")
hggggggg
#sum of N number
n=eval(input("Enter no."))
sum=0
for i in range(0,n+1):
sum=sum+i
#print(sum)
print("Sum is:",sum)
#Enter no.10
#Sum is:55
#sum of evenand odd number up to N
n=eval(input("Enter the numbers"))
even=0
odd=0
for i in range(0,n+1):
if(i%2==0):
even=even+i
else:
odd=odd+i
print("Sum of even numbers",even)
print("sum of odd numbers",odd)
#Enter the numbers34
#Sum of even numbers 306
#sum of odd numbers 289
#user defined function
def hello():
print("hello") #hello
hello()
#typical question
#add the digits of a positive integer repeatedly until the result has a single digit
def addsum(n):
s=0
while(n>0 or s>9):
if(n==0):
n=s
#print(n)
s=0
s=s+n%10
n=n//10
return s
n=eval(input("Enter any number:"))
print("sum in single digits ",addsum(n))
#Enter any number:65
#sum in single digits 2
Lecture 6: for loop, break, continue, recursion, chr and ord
#find factorial of number with recursion
def factorial(n):
if(n==1):
return 1
else:
return (n*factorial(n-1))
n=eval(input("Enter number:"))
if(n<0):
print("not valid")
elif(n==0 or n==1):
print("Factorial of",n,"is",1)
else:
print("Factorial of ",n,"is",factorial(n))
#Enter number:12
#Factorial of 12 is 479001600
#find factorial of number without recursion
n=eval(input("Enter number"))
if(n<0):
print("not valid")
elif(n==0 or n==1):
print("Factorial of",n,"is",1)
else:
f=1
while(n>1):
f=f*n
n=n-1
print("Factorial is",f)
#Enter number:12
#Factorial of 12 is 479001600
#chr and ord function
print(chr(97))
#'a'
print(ord('a'))
#97
#generate random password
c=''
for i in range(33, 128):
c=c+chr(i)
#print(c)
from random import choice
n=eval(input("Enter length of password"))
p=eval(input("Enter no. of passwords"))
print("Generated password is:")
for i in range(p):
password=''
for i in range(n):
password+=choice(c)
print(password)
#Enter length of password12
#Enter no. of passwords3
#Generated password is:
#b[&b_(2(9FMY
#=$4V29wn(A%$
#oLI3`J:lnQBf

More Related Content

What's hot

C Programming Language Part 8
C Programming Language Part 8C Programming Language Part 8
C Programming Language Part 8Rumman Ansari
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solutionAzhar Javed
 
Core programming in c
Core programming in cCore programming in c
Core programming in cRahul Pandit
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in cBUBT
 
Chapter 6 Balagurusamy Programming ANSI in c
Chapter 6  Balagurusamy Programming ANSI  in cChapter 6  Balagurusamy Programming ANSI  in c
Chapter 6 Balagurusamy Programming ANSI in cBUBT
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
Chapter 5 exercises Balagurusamy Programming ANSI  in cChapter 5 exercises Balagurusamy Programming ANSI  in c
Chapter 5 exercises Balagurusamy Programming ANSI in cBUBT
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CBUBT
 
C Programming Language Step by Step Part 5
C Programming Language Step by Step Part 5C Programming Language Step by Step Part 5
C Programming Language Step by Step Part 5Rumman Ansari
 
Chapter 2 : Balagurusamy_ Programming ANsI in C
Chapter 2 :  Balagurusamy_ Programming ANsI in CChapter 2 :  Balagurusamy_ Programming ANsI in C
Chapter 2 : Balagurusamy_ Programming ANsI in CBUBT
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020vrgokila
 
Let us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solutionLet us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solutionHazrat Bilal
 
Php in the graph (Gremlin 3)
Php in the graph (Gremlin 3)Php in the graph (Gremlin 3)
Php in the graph (Gremlin 3)Damien Seguy
 
Let us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solutionLet us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solutionrohit kumar
 
Aplikasi menghitung matematika dengan c++
Aplikasi menghitung matematika dengan c++Aplikasi menghitung matematika dengan c++
Aplikasi menghitung matematika dengan c++radar radius
 

What's hot (20)

C Programming Language Part 8
C Programming Language Part 8C Programming Language Part 8
C Programming Language Part 8
 
Ansi c
Ansi cAnsi c
Ansi c
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
Core programming in c
Core programming in cCore programming in c
Core programming in c
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in c
 
Chapter 6 Balagurusamy Programming ANSI in c
Chapter 6  Balagurusamy Programming ANSI  in cChapter 6  Balagurusamy Programming ANSI  in c
Chapter 6 Balagurusamy Programming ANSI in c
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
Chapter 5 exercises Balagurusamy Programming ANSI  in cChapter 5 exercises Balagurusamy Programming ANSI  in c
Chapter 5 exercises Balagurusamy Programming ANSI in c
 
C programming
C programmingC programming
C programming
 
BCSL 058 solved assignment
BCSL 058 solved assignmentBCSL 058 solved assignment
BCSL 058 solved assignment
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in C
 
C Programming Language Step by Step Part 5
C Programming Language Step by Step Part 5C Programming Language Step by Step Part 5
C Programming Language Step by Step Part 5
 
Chapter 2 : Balagurusamy_ Programming ANsI in C
Chapter 2 :  Balagurusamy_ Programming ANsI in CChapter 2 :  Balagurusamy_ Programming ANsI in C
Chapter 2 : Balagurusamy_ Programming ANsI in C
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 
Vcs17
Vcs17Vcs17
Vcs17
 
Let us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solutionLet us c (by yashvant kanetkar) chapter 1 solution
Let us c (by yashvant kanetkar) chapter 1 solution
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
Php in the graph (Gremlin 3)
Php in the graph (Gremlin 3)Php in the graph (Gremlin 3)
Php in the graph (Gremlin 3)
 
Let us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solutionLet us c(by yashwant kanetkar) chapter 2 solution
Let us c(by yashwant kanetkar) chapter 2 solution
 
Aplikasi menghitung matematika dengan c++
Aplikasi menghitung matematika dengan c++Aplikasi menghitung matematika dengan c++
Aplikasi menghitung matematika dengan c++
 
Matlab code for secant method
Matlab code for secant methodMatlab code for secant method
Matlab code for secant method
 

Similar to Python real time tutorial

fds Practicle 1to 6 program.pdf
fds Practicle 1to 6 program.pdffds Practicle 1to 6 program.pdf
fds Practicle 1to 6 program.pdfGaneshPawar819187
 
Xi CBSE Computer Science lab programs
Xi CBSE Computer Science lab programsXi CBSE Computer Science lab programs
Xi CBSE Computer Science lab programsProf. Dr. K. Adisesha
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdfsrxerox
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2Marc Gouw
 
The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)GroovyPuzzlers
 
data structure and algorithm.pdf
data structure and algorithm.pdfdata structure and algorithm.pdf
data structure and algorithm.pdfAsrinath1
 
Sharable_Java_Python.pdf
Sharable_Java_Python.pdfSharable_Java_Python.pdf
Sharable_Java_Python.pdfICADCMLTPC
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
 
python practicals-solution-2019-20-class-xii.pdf
python practicals-solution-2019-20-class-xii.pdfpython practicals-solution-2019-20-class-xii.pdf
python practicals-solution-2019-20-class-xii.pdfrajatxyz
 
Idiomatic Kotlin
Idiomatic KotlinIdiomatic Kotlin
Idiomatic Kotlinintelliyole
 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does notSergey Bandysik
 
Assignment on Numerical Method C Code
Assignment on Numerical Method C CodeAssignment on Numerical Method C Code
Assignment on Numerical Method C CodeSyed Ahmed Zaki
 
Swift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdfSwift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdfJkPoppy
 

Similar to Python real time tutorial (20)

Practicle 1.docx
Practicle 1.docxPracticle 1.docx
Practicle 1.docx
 
fds Practicle 1to 6 program.pdf
fds Practicle 1to 6 program.pdffds Practicle 1to 6 program.pdf
fds Practicle 1to 6 program.pdf
 
Xi CBSE Computer Science lab programs
Xi CBSE Computer Science lab programsXi CBSE Computer Science lab programs
Xi CBSE Computer Science lab programs
 
ECE-PYTHON.docx
ECE-PYTHON.docxECE-PYTHON.docx
ECE-PYTHON.docx
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2
 
The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)The groovy puzzlers (as Presented at JavaOne 2014)
The groovy puzzlers (as Presented at JavaOne 2014)
 
data structure and algorithm.pdf
data structure and algorithm.pdfdata structure and algorithm.pdf
data structure and algorithm.pdf
 
Sharable_Java_Python.pdf
Sharable_Java_Python.pdfSharable_Java_Python.pdf
Sharable_Java_Python.pdf
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
python practicals-solution-2019-20-class-xii.pdf
python practicals-solution-2019-20-class-xii.pdfpython practicals-solution-2019-20-class-xii.pdf
python practicals-solution-2019-20-class-xii.pdf
 
Idiomatic Kotlin
Idiomatic KotlinIdiomatic Kotlin
Idiomatic Kotlin
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does not
 
python codes
python codespython codes
python codes
 
Programs.doc
Programs.docPrograms.doc
Programs.doc
 
AI-Programs.pdf
AI-Programs.pdfAI-Programs.pdf
AI-Programs.pdf
 
notes.pdf
notes.pdfnotes.pdf
notes.pdf
 
Assignment on Numerical Method C Code
Assignment on Numerical Method C CodeAssignment on Numerical Method C Code
Assignment on Numerical Method C Code
 
Swift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdfSwift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdf
 

Recently uploaded

Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 

Recently uploaded (20)

Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 

Python real time tutorial

  • 1. Lecture 1:- print, id, type, basic data type (integer, float, string) print('this is first python class') #this is first python class print("hello student");print("welcome at inception") #hello student #welcome at inception # This is single line comment ''' this is multiline comment welcome at inception. ''' a=10 print(type(a)) #<class 'int'> b=12.2 print(type(b)) #<class 'float'> c='hello' print(type(c)) #<class 'str'> d="hello" print(type(d)) #<class 'str'> e='''hello how are you''' print(type(e)) #<class 'str'> #used for multiline string f="""hello how are you""" print(type(f)) #<class 'str'> #used for multiline string g=10 print(type(g)) #<class 'int'> #id of a and e is equal because both refer to same value #so value are stored at one place rather than multiple place #same concept are used in facebook for photo storing print(id(a)) #1522298624 print(id(g)) #1522298624 print(id(b)) #2240465414760 print(id(c)) #2321848675664 print(id(d)) #2321848675664 print(id(e)) #2321848802664 print(id(f)) #2321848802664 n=input("Enter any number") print(type(n)) #Enter any number11 #<class 'str'> n=int(input("Enter any number")) print(type(n)) #Enter any number12
  • 2. #<class 'int'> n=float(input("Enter any number")) print(type(n)) #Enter any number2.3 #<class 'float'> a=10 b=20 print(id(a)==id(b)) #False c=10 print(id(a)==id(c)) #True
  • 3. Lecture 2:- multi datatype declaration, input, eval, sqrt, fabs, comparison operators,if,else #this is single line comment a=b=10 print(a,b) #10 10 #swap of two number a,b=10,20 a,b=b,a print("a:",a,"b:",b) #a: 20 b: 10 #swap of two number a=eval(input("enter first number")) b=eval(input("enter first number")) x,y=a,b a,b=b,a print("value of", x, "and", y, "after swap",a,b) #enter first number10 #enter first number20 #value of 10 and 20 after swap 20 10 #temperature in Celsius and Fahrenheit c=eval(input("enter temperature in Celsius")) f=((9/5)*c)+32 print("temperature in Celsius", c,"is",f,"in Fahrenheit") #enter temperature in celcius37 #temperature in Celsius 37 is 98.60000000000001 in Fahrenheit c=(f-32)*(5/9) print("temperature in fahernite",f,"is",c, "in celcius") #temperature in fahernite 98.60000000000001 is 37.00000000000001 in celcius print(9/5) #1.8 print(9//5) #1 import math a=math.sqrt(4) print(a) #2.0 from math import sqrt a=sqrt(4) print(a) #2.0 #find hypotenuse of triangle b=eval(input("enter base of triangle")) h=eval(input("enter height of triangle")) import math
  • 4. hy=math.sqrt(h*h+b*b) print("hypotenuse of triangle with height",h,"and base",b,"is",hy) #enter base of triangle3 #enter height of triangle4 #hypotenuse of triangle with height 4 and base 3 is 5.0 #find hypotenuse of triangle from math import sqrt hy=sqrt(h*h+b*b) print("hypotenuse of triangle with height", h, "and base",b,"is",hy) #hypotenuse of triangle with height 4 and base 3 is 5.0 from math import fabs a=fabs(-4) print(a) #4.0 #comparison operators a=eval(input("enter first number:")) b=eval(input("enter second number:")) if(a<b): print("a=",a,"is less than b=",b) if(a>b): print("b=",b," is less than a=",a) if(a==b): print("b=",b," is equal to a=",a) if(a<=b): print("b=",b," is less or equal to a=",a) if(a>=b): print("b=",b," is greater than or equal to a=",a) if(a!=b): print("b=",b," is not equal to a=",a) #b= 10 is less than a= 50 #b= 10 is greater than or equal to a= 50 #b= 10 is not equal to a= 50
  • 5. Lecture 3: String, id, while, end print('He said,"Ram is honest"') #He said,"Ram is honest" #string s='hello' print(s,type(s)) #hello <class 'str'> s1="hello" print(s1,type(s1)) #hello <class 'str'> s2='''hello''' print(s2,type(s2)) #hello <class 'str'> s3="""hello""" print(s3,type(s3)) #hello <class 'str'> s="hello inception" print(s[3:5]) #lo print(s[6:15]) #inception print(s[-1:]) #n s="Hello Inception" #slicing of string s="Hello Inception" print(s[6:-1]) #'Inceptio' print(s[-1:-10]) #'' print nothing print(s[-1:-9]) #'' print nothing print(s[-9:-1]) #'Inceptio' print(s[14:0]) #'' print nothing #while loop i=1 while(i<=10): print(i,end=" ") #print value in one line i=i+1 else: print("bye") #perfect square from math import sqrt a=eval(input("enter any number")) b=sqrt(a) if(a==b*b):
  • 6. print(a,"is a perfect square") else: print(a,"is not perfect square") #enter any number25 #25 is a perfect square
  • 7. Lecture 4: for loop, and, or for i in range(0,5): print(i, end=" ") #0 1 2 3 4 for i in range(0,10,2): print(i,end=" ") #0 2 4 6 8 for i in range(10,0,-2): print("n",i,end=",") #10,8,6,4,2 a=10 b=20 c=10 if(a!=c) or (b<a): print('hi') else: print("hello") #hello #largest of three number a=eval(input("enter first no.")) b=eval(input("enter second no.")) c=eval(input("enter third no.")) if(a>b) and (a>c): print(a,"is largest") else: if(b>a) and (b>c): print(b,"is largest") else: print("c is largest") #leap year y=eval(input("Enter year")) if (y%4==0): if(y%100==0): if(y%400==0): print("leap year") else: print("not leap year") else: print("leap year") else: print("not leap year")
  • 8. #check number power of 3 n=eval(input("enter number")) while(n%3==0): n=n/3 if(n==1): print("power of 3") else: print("not power of 3")
  • 9. Lecture 5: for loop break, continue and pass # check if an integer is power of another integer n1=eval(input("Enter integer")) n2=eval(input("ckeck for integer")) while(n1%n2==0): n1=n1/n2 if(n1==1): print("power of ",n2) else: print("not power of ",n2) #break demonstration for i in range(14): if(i==5): break print(i) print("good bye") #continue demonstration for i in range(14): if(i==5): continue print(i) print("good bye") #pass demonstration for letter in 'python': if (letter=='h'): pass print("this is pass") print("current letter",letter) print("bye") hggggggg #sum of N number n=eval(input("Enter no.")) sum=0 for i in range(0,n+1): sum=sum+i #print(sum) print("Sum is:",sum) #Enter no.10 #Sum is:55 #sum of evenand odd number up to N n=eval(input("Enter the numbers")) even=0
  • 10. odd=0 for i in range(0,n+1): if(i%2==0): even=even+i else: odd=odd+i print("Sum of even numbers",even) print("sum of odd numbers",odd) #Enter the numbers34 #Sum of even numbers 306 #sum of odd numbers 289 #user defined function def hello(): print("hello") #hello hello() #typical question #add the digits of a positive integer repeatedly until the result has a single digit def addsum(n): s=0 while(n>0 or s>9): if(n==0): n=s #print(n) s=0 s=s+n%10 n=n//10 return s n=eval(input("Enter any number:")) print("sum in single digits ",addsum(n)) #Enter any number:65 #sum in single digits 2
  • 11. Lecture 6: for loop, break, continue, recursion, chr and ord #find factorial of number with recursion def factorial(n): if(n==1): return 1 else: return (n*factorial(n-1)) n=eval(input("Enter number:")) if(n<0): print("not valid") elif(n==0 or n==1): print("Factorial of",n,"is",1) else: print("Factorial of ",n,"is",factorial(n)) #Enter number:12 #Factorial of 12 is 479001600 #find factorial of number without recursion n=eval(input("Enter number")) if(n<0): print("not valid") elif(n==0 or n==1): print("Factorial of",n,"is",1) else: f=1 while(n>1): f=f*n n=n-1 print("Factorial is",f) #Enter number:12 #Factorial of 12 is 479001600 #chr and ord function print(chr(97)) #'a' print(ord('a')) #97 #generate random password c='' for i in range(33, 128): c=c+chr(i) #print(c) from random import choice n=eval(input("Enter length of password"))
  • 12. p=eval(input("Enter no. of passwords")) print("Generated password is:") for i in range(p): password='' for i in range(n): password+=choice(c) print(password) #Enter length of password12 #Enter no. of passwords3 #Generated password is: #b[&b_(2(9FMY #=$4V29wn(A%$ #oLI3`J:lnQBf