Subscribe this Blog

Wikipedia

Search results

Notifications and New Posts!

Thursday, November 12, 2020

YouTube Premiered Lecture - November 12, 2020, 01:00 PM - ADVANCED PROGRAMMING CONCEPTS - Python (TY A and B)

  ADVANCED PROGRAMMING CONCEPTS - Python

Due to internet/network connectivity issue, 

I will be conducting lecture on YouTube. 
Lecture will start at sharp 01:00 PM today. 
Please attend it. And if you have any questions then
please ask in Comment box below the video.

Topics which will be covered in this session are:
1. Inheritance in python
2. Scope of variable - Local and Global

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.
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 01:00 PM today.
To ask questions in Chat Box/Comment Box :

Facebook Event Registration: Click here

Python Programs:

#Adding Method - part of inheritance
#Add a method called welcome to the Student class.

class Person:
  def __init__(self, fname, lname):
    self.firstname = fname
    self.lastname = lname

  def printname(self):
    print(self.firstname, self.lastname)

class Student(Person):
  def __init__(self, fname, lname, year):
    super().__init__(fname, lname)
    self.graduationyear = year

  def welcome(self):
    print("Welcome", self.firstname, self.lastname, "And Your Birth Year=", self.graduationyear)
    self.printname()

x = Student("Rahul", "Shinde", 2000)
x.welcome()
Output:
Welcome Rahul Shinde And Your Birth Year= 2000
Rahul Shinde


#Scope of Variable - Global and Local variable

#Changing value of global variable
x = 300

def myfunc():
  global x
  x = 200
  print("Value of x in myfunc():",x)


print("Value of x in python main script:",x,"Before calling myfunc()")

myfunc()

print("Value of x in python main script:",x,"Afte calling myfunc()")

Output:
Value of x in python main script: 300 Before calling myfunc()
Value of x in myfunc(): 200
Value of x in python main script: 200 Afte calling myfunc()


# Global Keyword
# If you need to create a global variable,
# but are stuck in the local scope, you can use the global keyword.
#
# The global keyword makes the variable global.

def myfunc():
  global x
  x = 300
  print("Value of x in the myfunc():",x)

myfunc()

def valueofx():
  print("Value of x in valueofx():",x)

print("Value of x in main python script:",x)

valueofx()
Output:
Value of x in the myfunc(): 300
Value of x in main python script: 300
Value of x in valueofx(): 300


# Naming Variables
# If you operate with the same variable name inside and outside of a function,
# Python will treat them as two separate variables,
# one available in the global scope (outside the function)
# and one available in the local scope (inside the function).

x = 300

def myfunc():
  x = 200
  print("Value of x in myfunc():",x)

myfunc()

print("Value of x in python main script:",x)

Output:
Value of x in myfunc(): 200
Value of x in python main script: 300



# Global Scope
# A variable created in the main body of the Python code is a global
# variable and belongs to the global scope.
#
# Global variables are available from within any scope, global and local.

#x = 300
#x is global variable

x = 300

def myfunc():
  print("Value of x in myfunc():",x)

def valueofx():
  print("Value of x in valueofx():",x)


myfunc()

print("Value of x from the main python script:",x)

valueofx()
Output:
Value of x in myfunc(): 300
Value of x from the main python script: 300
Value of x in valueofx(): 300



# Function Inside Function
#nested function
# As explained in the example above,
# the variable x is not available outside the function,
# but it is available for any function inside the function.

def myfunc():
  x = 300
  print("Value of x in the myfunc:", x)
  def myinnerfunc():
    print("Value of x in the myinnerfunc:",x)
    def partmyinnerfunc():
      print("Value of x in the partmyinnerfunc:", x)
    partmyinnerfunc()
  myinnerfunc()

myfunc()
#print("Value of x in the main script of python:",x)


Output:
Value of x in the myfunc: 300
Value of x in the myinnerfunc: 300
Value of x in the partmyinnerfunc: 300



# A variable is only available from inside the region it is created.
# This is called scope.

# Local Scope
# A variable created inside a function belongs to the local scope of that function,
# and can only be used inside that function.


def myfunc():
  x = 300
  print("Value of x:",x)
  print("x is local variable")
  print("x+10=",x+10)

myfunc()
#print(x)


Output:
Value of x: 300
x is local variable
x+10= 310

Present Students:
Amol Sul ​TA11
pranay disale ​TYA_50
Yash Gadekar ​TYA_25
Aditya Motewar ​TYA46
Sushant Jadhav ​TYB_65
TYA_64 Sohel Shikalgar ​TYA 64
saurabh chavan ​TYA_16
Vijay Mali ​TYB_26
TYB_33 Ridham Parmar ​TYB_33
Om Metkari ​TYB_28
SAMARTH CHAVAN ​TA15
TYB_44 Aftab Shaikh ​TYB_44
SALIM SHAIKH ​TYB_45
TYA_73 Ashley Thomas ​TYA_73
Suraj More ​TYA 45
TYB_71_Onkar Kale ​TYB_71
manthan dixit ​TYB16
TYB_58 SANDIP BAGUL ​TYB_58
TYB_55 Saurabh Wadekar ​TYB 55
TYB_53 Krishna Langote ​TYB_53
TYB_41 Yasar Khatik ​TYB_41
TYA_18 Yogesh chavan ​TA18
Samarth Mane-Deshmukh ​TYA_51
Vinayak Bapat ​TYB_11
Harshvardhan Ubale ​TYB_50
Amol Sul ​TA11
TYB_17 Abhinay Gaikwad ​TB17
Its_Pranav_ Show ​TYB 59
Yogesh patil ​TYB_36
Saurabh Nikam ​TYB-32
Irfan Mulani ​TYA_54
bharat burungale ​TA14
Pravin Somdale ​TYA_65
ABHI KHOTE ​TYB_22
Harshal Nagtilak ​TYB_30
Komal Achugatla ​TYA_01
Shraddha gajakosh ​TYA_02
sumit Patwari ​TYB_77
Omkar Jagtap ​TYB_66
Ganesh Todkar ​TA24
TYA_44 Mangesh Misal ​TYA_44
Snehal Mane ​TYB_04
TYB_62 Nitin Eakamalli ​TY B 62
Jaydev nanaware ​TYB_31
Vaishnavi Lakheri ​TYA_04
OMKAR PAWAR ​TYB_37
Sachin Kshirsagar ​TYA_42
Rutik Godse ​TYA_31
Akash Mane ​TYB_70
Deepak Shinde ​TYB_46
TYB_41 Yasar Khatik ​TB 41
Shreeyash Chavan ​TYA_17
TYB_75 Hrushikesh Walujkar ​TYB_75
Aazam Shaikh ​TYA_63
Madhuri Parchandrao ​TYA_06
TYB_03 Arati Lale ​TB 03
TYB_17 Abhinay Gaikwad ​TB17
TYA_13 Atish Jadhav ​TYA 13
Learning is essential. Learn Free ​TYB_54
TYB_48 Vishwajit Shinde ​TYB 48
Nanasaheb Shinde ​TYB_47
TYB_17 Abhinay Gaikwad ​TB17
Its_Pranav_ Show ​TYB 59
deepjyoti sathe ​TA08
Vaibhav Bhosale ​TB 13
Samruddhi Deshpande ​TYB_01
TYB_41 Yasar Khatik ​TYB_41

No comments:

Post a Comment