Python default arguments are awesome! 👍

preview_player
Показать описание
#python #tutorial #course

00:00:00 default arguments
00:03:16 exercise

# ----- EXAMPLE -----
def net_price(list_price, discount=0, tax=0.05):
return list_price * (1 - discount) * (1 - tax)

# print(net_price(500))
# print(net_price(500, 0.1))
# print(net_price(500, 0.1, 0))

# ----- EXERCISE -----
import time

def count(end, start=0):
for x in range(start, end+1):
print(x)
print("DONE!")

# count(10)
# count(30, 15)
Рекомендации по теме
Комментарии
Автор

# EXAMPLE
def net_price(list_price, discount=0, tax=0.05):
return list_price * (1 - discount) * (1 - tax)

# print(net_price(500))
# print(net_price(500, 0.1))
# print(net_price(500, 0.1, 0))

# EXERCISE
import time

def count(end, start=0):
for x in range(start, end+1):
print(x)
time.sleep(1)
print("DONE!")

# count(10)
# count(30, 15)

BroCodez
Автор

U are so good at explaining these concepts! Thank u!

auggiea
Автор

Thank you for an awesome video. I found your videos while I was making a video on creating the Snake game in Python. Subscribed immediately 😆

studyingasyouwere
Автор

Your explanation is very good and clear. Love your vids bro <3

skyisthelimpet
Автор

amazingly underrated video, explained perfectly. thank you bro code

Dexeyz
Автор

It is absolutely great! I like python.

ViktorSamosiuk-wufq
Автор

Good voice and excellent explanation 👍.

krzysiekkrzysiek
Автор

defaults arguments are defaults, love them :) thx

piotrkopcewicz
Автор

How are you so good at explaining stuff so easy

NotTheHeroStudios
Автор

By any chance did you make any videos on introduction to Git & GitHub for beginners?... Ur videos are nicely explained and really thx, i really learned basics of python through your videos

sumitpaul
Автор

Mr. Bro, you're awesome
Yeah, let's defeat the YouTube algorithm 🥋

The-Martian
Автор

wooow, ty for the vid ngl my teacher exaplaining this made no sence.
btw what does time.sleep(1) do?

flamingice
Автор

How did you add Fundraiser symbol, can you please provide me some info.

Weblearns
Автор

Well u can adjust the time in time.sleep() by how fast do u want to

NamNguyen-mzyh
Автор

I am currently learning Java. Is this approach the same as "overloading methods" ?

Sturziii
Автор

Can you please make more java swing apps!!

jadotati
Автор

It can be used in a video game made in Python... 🤔

SkyFly
Автор

Please make node js react vue js tutorials why all the time the same pyhthon and MySql

Shohjahon
Автор

def products(we_bougt, its_price, its_total_taxes):
print(f'we bought a {we_bougt}')
print(f'its total price is a {its_price} dollar')
print('total taxes is', its_total_taxes )
print('total is you will pay is a', its_price + its_total_taxes)

products('Xbox Series S', 550, 0.15)

WE CAN MAKE SOMETHING ON LIKE THAT WE DO NOT NEED TO A RETURN

Uberdurden