Python assign functions to variables 📛

preview_player
Показать описание
Python assign a function to a variable

#python #function #variable

def hello():
print("Hello")

hi = hello
hi()

# say = print
# say("Whoa! I can't believe this works! :O")

Bro Code merch store 👟 :
===========================================================
===========================================================
Рекомендации по теме
Комментарии
Автор

def hello():
print("Hello")


hi = hello
hi()

# say = print
# say("Whoa! I can't believe this works! :O")

BroCodez
Автор

thank you so much, It was so informative

mahyar
Автор

Thanks a lot for these unique videos Bro. I think this method, assigning functions to variables, is how people create new programming languages, right? I understood so.

mustafaunlu
Автор

Awesome video, keep up the great work! :)

ComputerScienceSimplified
Автор

TO PRINT THE LIST USING WALRUS OPERATOR, JUST ENCLOSED THE food and the input within parentheses as shown below:

foods = list()
while (food := input("What food do you like?: ")) != "quit":
foods.append(food)

print(foods)

# or...
for food in foods:
print(food)

stranger
Автор

iam watching for a few days now, i started at the first video, , but damn i love you vids thank you sir

huntressartemis
Автор

say = print
say("Thank you Bro!")

lw
Автор

For example in tkinter when we type a variable = Tk() it the same thing ??

yassinewaterlaw
Автор

Dude please add python projects for programmes

faiyazahmad
Автор

Sir how to use it with formatted string -->
code:


def efdot():
bar = "⦾⦿"
index = 0
while True:
print(bar[index % len(bar)], end="\r")
index += 1
time.sleep(0.5)


dot = efdot
var = input(f"{dot}Hello World")


output:

<function efdot at World

zyrixel-mc