# -*- coding: utf-8 -*-
"""
Created on Thu Dec 24 07:39:48 2020
day:17
topic: lambda
@author: anil
def x_fn(a):
print(a+10)
x_fn(25)
x = lambda a : a + 10
print(x(25))
lambda a : a + 10
a=lambda a : 5 + 10
print(a(5))
a=lambda a : a + 10
print(a(5))
a=lambda a : a + 10
print(a(5))
a=lambda a,b : a * b
print(a(5,6))
a=lambda a,b,c : (a * b)+c
print(a(5,6,7))
a=lambda a,b,c : (a * b * c)
print(a(5,6,7))
a=lambda a,b,c,d,e,f,g : a * b * c+d-e/f%g
print(a(5,6,7,5,5,5,5))
a=lambda a,b,c,d,e,f,g : a * b * c+d-e/f%g
print(a(5,6,7))
cars = ["Ford", "Volvo", "BMW"]
print(cars)
print(type(cars))
fruits = ['apple', 'banana', 'cherry']
x = fruits.index("cherry")
print(x)
x = fruits.index("banana")
print(x)
#pass by value
#pass by reference
def BMW_function(a):
print(a)
b=(15*120)
BMW_function(b)
def BMW_function(a):
print(a)
b=10
BMW_function(15*150)
BMW_function(15*150)
BMW_function(15*120)
BMW_function(15*120)
BMW_function(15*120)
BMW_function(15*120)
BMW_function(15*120)
def BMW_function(a):
print(a)
b=10*17*16*6237*73246*167*5454*12
BMW_function(b)
BMW_function(b)
BMW_function(b)
BMW_function(b)
BMW_function(b)
BMW_function(b)
BMW_function(b)
def BMW_function(a):
print("a:",a)
print(a)
if __name__ == '__main__' :
b=10
BMW_function(b)
print(b)
global a
def brother_function(b):
print("a:",a)
def small_brother_function(c):
print("a:",a)
def sister_function(d):
print("a:",a)
if __name__ == '__main__' :
a=10
sister_function(a)
small_brother_function(a)
brother_function(a)
print(a)
"""
global a
def brother_function(b):
print("a:",a)
def small_brother_function(c):
print("a:",a)
def sister_function(d):
print("a:",a)
if __name__ == '__main__' :
a=10
sister_function(a)
small_brother_function(a)
brother_function(a)
print(a)
No comments:
Post a Comment