tubeshowcase●1,194,391 videosβ™‘ My collection 0
← Learn to Code

Learn to Code06:44

Python keyword arguments are awesome! πŸ—οΈ

Bro Code β†—

From the creator

#python #tutorial #course 00:00:00 example 1 00:03:20 example 2 00:04:36 exercise 00:06:19 conclusion # keyword arguments = arguments prefixed with the names of parameters # order of the arguments doesn’t matter # helps with readability # ----- EXAMPLE 1 ----- def hello(greeting, title, first, last): print(f"{greeting} {title}{first} {last}") hello("Hello", title="Mr.", last="John", first="James") # ----- EXAMPLE 2 ----- for number in range(1, 11): print(number, end=" ") print("1", "2", "3", "4", "5", sep="-") # ----- EXERCISE ----- def get_phone(country, area, first, last): return f"{country}-{area}-{first}-{last}" phone_num = get_phone(country=1, area=123, first=456, last=7890) print(phone_num)

Published 2022-11-30 Β· Watch on YouTube β†—
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code