val = 10
def update():
global val
val = 20
del val
update()
try:
print(val)
except NameError:
print("NameError")
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
def swap(a, b):
return b, a
x, y = 10, 20
x, y = swap(x, y)
x, y = swap(y, x)
print(x + y)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
val = 10
def update():
global val
val = 20
del val
update()
try:
print(val)
except NameError:
print("NameError")
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
def func(a, b, c, d):
return a + b * c - d
args = [2, 3]
kwargs = {'c': 4, 'd': 5}
result = func(*args, **kwargs)
print(result)
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM
colors = ['red', 'green', 'blue']
colors.insert(1, colors.pop())
colors.reverse()
print(colors[0])
#Python
Please open Telegram to view this post
VIEW IN TELEGRAM