Learn Python CONDITIONAL EXPRESSIONS in 5 minutes! ❓

preview_player
Показать описание
# conditional expression = A one-line shortcut for the if-else statement (ternary operator)
# Print or assign one of two values based on a condition
# X if condition else Y
Рекомендации по теме
Комментарии
Автор

# conditional expression = A one-line shortcut for the if-else statement (ternary operator)
# Print or assign one of two values based on a condition
# X if condition else Y

num = 5
a = 6
b = 7
age = 13
temperature = 20
user_role = "guest"

print("Positive" if num > 0 else "Negative")
result = "EVEN" if num % 2 == 0 else "ODD"
max_num = a if a > b else b
min_num = a if a < b else b
status = "Adult" if age >= 18 else "Child"
weather = "HOT" if temperature > 20 else "COLD"
access_level = "Full Access" if user_role == "admin" else "Limited Access"

BroCodez
Автор

It's best channel to learn to code thanks maan ❤

StudyMaryada
Автор

I am a Junior Developer and work extensively with Django. Your Python videos are absolutely phenomenal . I am currently going through all of them and they are helping me get better clarity about many concepts. Kudos to you!

frontendmechanix
Автор

im binge watching your Python tutorial playlist and i love it. You are the best teacher ive ever seen.
Thanks for making this for free

Knight_with_gun
Автор

I have been watching his videos for 1 month, and I absolutely love it

wardaalrifa
Автор

Thanks... I applied if else like you taught:


age = int(input("Enter your age: ")
print("Toddler" if age <= 3 else ("Kid" if age >= 4 and age <= 12 else ("Teenager" if age >= 13 and age <= 19 else ("Young Adult" if age >= 20 and age <= 35 else ("Adult" if age >= 36 and age <= 59 else

ratulmitra
Автор

Best for me good trainer, i really learn Python & so many things from your channel....From Bangladesh 🇧🇩❤️

maishasunny
Автор

you are THE gigachad, man, not only teach others to program, but getting money to the hospital, you're the best!

albertojesusalvaradogarza
Автор

I love your lessons Bro. Thanks!!!

user = input("User Status "
"\n1. Admin: "
"\n2. Moderator: "
"\n3. Guest: "
"\nInput your status (1/2/3): ")

access = "Full Access: You are in!" if user == "1" else (
"Limited Access: Good luck!" if user == "2" else ("Access Denied" if user == "3" else "Wrong Input"))
print(access)

pauljnr
Автор

Thank you. Once you started using words instead of numbers it finally clicked into my head .

Futballr
Автор

I love your teaching method
Can you please teach us android app development?

bizualemtesfa
Автор

Bro, - your tuts are I love it so clear you made it and all understandable and so simple!!! Do you have any paid version of python courses where you go deep down the rabbit hole and gets higher difficulty in python? Or all you make are free courses? Thank you so much!

II-ergj
Автор

Thanks for teaching me python
tommorrow is my last python test :D

AGoXD
Автор

Bro a channel with 1M subs only getting 70 views? Bro you are underrated

CodingDevelopers
Автор

hey bro i rlly like ur vids i always watch them if im confused with something
but bro how to get a colour scheme of a terminal just like urs??
edit: i just watched ur 12 hours python video and u gave a tut for ur colour scheme and font tysm bro!

hxmza
Автор

can you please do spring boot series all aboput java fullstack?

mintz
Автор

Can you code on a laptop? Like what specs do you need?

Levitate.
Автор

Bro, upload swift programming language if you know. 👍

iron_blood