ADVANCED PROGRAMMING CONCEPTS - Python
Due to internet/network connectivity issue,
I will be conducting lecture on YouTube.
Lecture will start at sharp 16:15 today.
Please attend it. And if you have any questions then
please ask in Comment box below the video.
In this Session, I have covered following points:
Python functions
Due to Internet connectivity issue making premiered video can be great tool
where without any kind of interruption students can watch lecture video.
YouTube Session
ADVANCED PROGRAMMING CONCEPTS - Python (TY A and B)
Punyashlok Ahilyadevi Holkar Solapur University.
TY Mechanical Engineering Students.
Punyashlok Ahilyadevi Holkar Solapur University.
TY Mechanical Engineering Students.
Ref.: https://www.w3schools.com/python/
For more clarity please watch YouTube video with 360p or 480p Quality.
Please click on the three vertical dots on video then select Quality option.
Then select resolution as 360p or 480p.
Please write you Name and Roll Number in Live Chat Box/Comment Box (below Video in YouTube) to capture your attendance.
YouTube Video Lecture:
This video is premiered it will start at sharp 16:00 pm today.
To ask questions in Chat Box/Comment Box :
Facebook Event Registration - Click here
python programs:
# Python Lambda
# A lambda function is a small anonymous function.
# A lambda function can take any number of arguments,
# but can only have one expression.
# Syntax
# lambda parameter : expression
#The expression is executed and the result is returned.
x = lambda a : a + 10
print(x(5))
# here a is parameter.
#5 is our argument.
# lambda functions can take any number of arguments:
Output:
15
# lambda functions can take any number of arguments.
# lambda with two arguments
x = lambda a, b : a * b
print(x(5, 6))
print(x)
print(type(x))
Output:
30
<function <lambda> at 0x0000020D6E7161F0>
<class 'function'>
# lambda functions can take any number of arguments.
# lambda with three arguments
x = lambda a, b, c : a + b + c
print(x(5, 6, 2))
Output:
13
# Why Use Lambda Functions?
# The power of lambda is better shown
# when you use them as an anonymous function inside another function.
def myfunc(n):
return lambda a : a * n
mydoubler = myfunc(2)
print(mydoubler(11))
print(mydoubler)
print(type(mydoubler))
print(type(myfunc))
Output:
22
<function myfunc.<locals>.<lambda> at 0x000001A3FD53E550>
<class 'function'>
<class 'function'>
#Use the same function definition to make a function
# that always triples the number you send in.
def myfunc(n):
return lambda a : a * n
mytripler = myfunc(3)
print(mytripler(11))
#Use lambda functions when an anonymous function is required for a short period of time.
Output:
33
# Python Classes/Objects
# Python is an object oriented programming language.
# Almost everything in Python is an object, with its properties and methods.
# A Class is like an object constructor, or a "blueprint" for creating objects.
# Create a Class
# To create a class, use the keyword class:
# class MyClass:
# x = 5
# Create Object
# Now we can use the class named MyClass to create objects:
# p1 = MyClass()
# #
# print(p1.x)
class display:
y="Welcome"
#
q=display()
#
print(q.y)
Output:
Welcome
# The __init__() Function
# To understand the meaning of classes
# we have to understand the built-in __init__() function.
# All classes have a function called __init__(),
# which is always executed when the class is being initiated.
# Use the __init__() function to assign values to object properties,
# or other operations that are necessary to do when the object is being created:
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
p1 = Person("Rahul", 22)
print("Student Name:",p1.name)
print("Age of Student:",p1.age)
# Note: The __init__() function is called automatically every time
# the class is being used to create a new object.
p2 = Person("Ganesh", 23)
#
print("Student Name:",p2.name)
print("Age of Student:",p2.age)
Ouput:
Student Name: Rahul
Age of Student: 22
Student Name: Ganesh
Age of Student: 23
# Object Methods
# Objects can also contain methods.
# Methods in objects are functions that belong to the object.
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def myfunc(self):
print("Hello my name is " + self.name)
print("Age is :",self.age)
p1 = Person("Ram", 36)
p1.myfunc()
Ouput:
Hello my name is Ram
Age is : 36
Present Students:
pranay disale Pranay Disale TYA_50
TYA_64 Sohel Shikalgar TY A 64
SAMARTH CHAVAN TA 15
sumit Patwari TYB_77
ADESH BANKAR TYB_09
TYA_13 Atish Jadhav TYA 13
SALIM SHAIKH TYB_45
TYB_55 Saurabh Wadekar TYB 55
saurabh chavan TYA_16
Sachin Kshirsagar TY_A_42
Prathmesh Kirgat TYA_41
Suraj More TYA 45
TYA_44 Mangesh Misal TYA_44
TYB_44 Aftab Shaikh TYB_44
Vijay Mali TYB_26 AMOL MALI
Omkar Jagtap TYB_66
TYB_41 Yasar Khatik TYB_41
TYA_29 Yuvraj Shelar TYA_29
TYA_38 Saurabh Kadasare TYA_38
VINAYAK Gawali TYA_72
Samarth Mane-Deshmukh TYA_51
TYA_57 PRITAM Padage TYA_57 PRITAM PADAGE
Madhuri Parchandrao TYA_06
TYB_71_Onkar Kale TYB_71_ Onkar M Kale
TYB_17 Abhinay Gaikwad TYB_17
Saleha Mirjkar TYA-05
Harshvardhan Ubale TYB_50
TYA_51 Samarth Mane-Deshmukh TYA_51
Komal Achugatla TYA_01
Learning is essential. Learn Free TYB54
Ganesh Todkar TA24
Vaibhav Bhosale TB 13
Shashikant Thorat TA66
TYB_20 Dhondiram Waghmode TYB_20
Pravin Somdale TYA_65
Sachin Waghmare TA49
Yogesh Autade TYB_57
TYA_35 Parchandrao Chandragupta Vinayak TYA_35 Parchandrao Chandragupta Vinayak
onkar deokar TYA22
Snehal Mane TYB_04
Shraddha gajakosh TYA_02 shraddha gajakosh
TYB_53 Krishna Langote TYB_53
Milind Jagadale TYA_34 Milind Jagadale
TYA_73 Ashley Thomas TYA_73 Ashley A Thomas
Gayatri Joshi TYA_03 GAYATRI VINAYAK JOSHI
Its_Pranav_ Show TYB 59 Pranav Bhandare
manthan dixit TYB16
Nilesh Kadam TYB-21
TYB_41 Yasar Khatik TYB_41
TYB_05 Vaishali MoreTYB_05
deepjyoti sathe TA08
Kashiling Sarak TYB_42
Akshay Pansare TA43
Samruddhi Deshpande TYB_01
pruthviraj deshmukh TYA23
TYB_17 Abhinay Gaikwad TYB_17
Rupesh Dhere TYB 61
ABHI KHOTE TYB_22
TYB_70 Akash Mane TYB_70
Rupesh Dhere Rupesh Dhere
TYB_44 Aftab Shaikh TYB_44
Harshal Nagtilak TYB_30
Hritik Bhosale TYB 12
TYB_41 Yasar Khatik TYB_41
CREATIVITY INFINITY TA07
PrerAna Ekatpure TYB02
TYA_57 PRITAM Padage TYA57
Aditya Motewar TYA46
No comments:
Post a Comment