Technical Interviews Part 1-Python
Technical Interviews Part 1-Python
For ex:
L1 = [1,2,3,4]
T1 = (1,2,3,4)
L1[0] = 5
Print(L1)
Output: [5,2,3,4]
But in tuple
T1[0] = 5
Error: ‘Tuple’ object doesnot support item assignment
def whisper(text):
return text.lower()
def greet(func):
# storing the function in a variable
greeting = func("""Hi, I am created by a function passed as an
argument.""")
print (greeting)
greet(shout)
greet(whisper)