Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lambda/example2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Add 10 to argument a, and return the result:
x = lambda a : a + 10
print(x(5))

# square of number
squ = lambda num: num**2
print(squ(5))

# Summarize argument a, b, and c and return the result:
x = lambda a, b, c : a + b + c
print(x(5, 6, 2))


# reverse a string with the help of list, map, lamda
fun=["pthon","is","fun"]
ans=(list(map(lambda x:x[::-1],fun)))
print(ans)

# first latter of word of list
name=["python","with","s3cloudehub"]
(print(list(map(lambda n:n[0],name))))

# print even number
mynum=[1,2,3,4,5,6]
print(list(filter(lambda num:num%2==0,mynum)))
17 changes: 17 additions & 0 deletions nested_stetment_and_scop/local_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Local Reassigment!
x=200
print(f"just localy change x to {x}")

# How To Run
# local_ocal_example.py"
# output just localy change x to 200

def myfunc():
x = 300 #local veriabal
print(x)

myfunc()

# How To Run
# local_ocal_example.py"
# output 300