Тёмный

If statements in Python are easy (if, elif, else) 🤔 

Bro Code
Подписаться 1,9 млн
Просмотров 110 тыс.
50% 1

#python
Python if elif else control flow
00:00:00 if statements
00:01:27 else statements
00:02:19 elif statements
00:04:22 exercise 1
00:05:45 exercise 2
00:06:37 booleans
00:08:03 conclusion

Опубликовано:

 

19 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 104   
@BroCodez
@BroCodez Год назад
# if = Do some code IF condition is True # else = Do something else if above condition/s are False # ---------------------- # EXAMPLE 1 # ---------------------- age = int(input("Enter your age: ")) if age >= 100: print("You are too old to sign up") elif age >= 18: print("You are now signed up") elif age < 0: print("You haven't been born yet") else: print("You must be 18+ sign up") # ---------------------- # EXAMPLE 2 # ---------------------- response = input("Do you want food (Y/N)?: ") if response == "Y": print("Have some food") else: print("No food for you!") # ---------------------- # EXAMPLE 3 # ---------------------- name = input("Enter your name: ") if name == "": print("You did not enter your name!") else: print(f"Hello {name}") # ---------------------- # EXAMPLE 4 # ---------------------- online = False if online : print("You are online") else: print("You are offline")
@hassanawdi3793
@hassanawdi3793 Год назад
In example 1 you could do if age>=18 and age
@breadtoast118
@breadtoast118 7 месяцев назад
Thank you
@daydarasensei12
@daydarasensei12 Год назад
print("Thank you Bro! You're GOLD!")
@PDsChannel0112
@PDsChannel0112 Год назад
Thank you Bro! You're GOLD!
@Devilhunter69
@Devilhunter69 11 месяцев назад
Typeface error : line 1 Idiot
@The_Lahmacun123
@The_Lahmacun123 5 месяцев назад
Python in youtube 😅​@@PDsChannel0112
@sketchwithviren85
@sketchwithviren85 2 месяца назад
@@PDsChannel0112 print("you all are gold")
@PDsChannel0112
@PDsChannel0112 2 месяца назад
@@sketchwithviren85you all are gold
@Tony.Vibez.
@Tony.Vibez. 7 месяцев назад
Don’t stop making videos dude, ur one of the best teachers on here man 👏
@jetty4205
@jetty4205 2 месяца назад
Just started watching this series and you are an amazing teacher, very easy to follow along and information is sticking pretty well. Not forgetting what I've learnt from you so far. Well done man, these lessons still helping people out a year after being uploaded
@ronnies.3440
@ronnies.3440 7 месяцев назад
Best learning to code channel. Breaks it down so well.
@braydenfrith6066
@braydenfrith6066 Год назад
awesome explanations dude everything was clear and concise as a beginner, keep up the work subbed
@user-ace96plays
@user-ace96plays 7 месяцев назад
NICELY DONE BRO...❤
@anjali1977
@anjali1977 Год назад
Age=int(input ( " enter your age:")) If age 60: Print("your age is too old to marry") Else: Print("you both are perfect match each other") Even or odd Num=int(input ("enter your number:") If (num%2)==0: Print("number is even") Else: Print("number is odd") If statement Num=int(input("enter your number:") If ( num%2)==0
@johndank2209
@johndank2209 Год назад
shouldn't it be (Num%2)?
@fishy1818
@fishy1818 7 месяцев назад
yes @@johndank2209
@htg7127
@htg7127 Месяц назад
num = int(input("Enter your number:")) if (num%2) == 0: print("Number is even.") else: print("Number is odd.")
@user-ly5we6xl4v
@user-ly5we6xl4v 7 месяцев назад
NICELY DONE...❤
@thakre69
@thakre69 Год назад
bro you should have posted a community post asking people to "join me to learn python everyday" since you are updating the python playlist. But still thanks for the content and teaching sir, LOVE from INDIA🧡
@humbleharisonofficial2382
@humbleharisonofficial2382 9 месяцев назад
Thank you very much, sir, I wish my lecturer were like you. please do another video on how to create multiple-choice quizzes.
@joncaldwell4753
@joncaldwell4753 18 дней назад
Much appreciated
@aCartonOfNeinLives
@aCartonOfNeinLives Год назад
Free Lessons. love the vids u are the man
@TypicalVole2437
@TypicalVole2437 Год назад
This was easy to learn thank you
@SteveNonkonyana
@SteveNonkonyana 15 дней назад
Thanks this helps, am now subscribed
@jasonhammerle3582
@jasonhammerle3582 11 месяцев назад
🤘Great Content!
@user-fc8vj5dy9g
@user-fc8vj5dy9g 6 месяцев назад
hey bro thanks for these awsome videos!
@wmstram1
@wmstram1 Год назад
Watched it. Liked it.
@o9_169
@o9_169 Год назад
thank you guy on the internet
@fbushphone
@fbushphone 2 месяца назад
Thanks for sharing. I always recommend you to the crew at the YMCA comp club I run. How do you get that colorful terminal text?
@v4mp1r3gurl6
@v4mp1r3gurl6 Год назад
Thank youuuuu this is very helpful
@3MILFOR3VER
@3MILFOR3VER Год назад
Love it bro!
@khantzinhein2415
@khantzinhein2415 2 месяца назад
Bro, you're the best.
@MystikPrae
@MystikPrae Год назад
age=int(input("Enter your age: ")) if age0: print("You aren't eligible to take driving license") elif age >18 and age60: print("Being a aged person, you aren't eligible for driving license") else: print("You haven't been born
@Afghanistanfutsalfans
@Afghanistanfutsalfans Год назад
fully explained!
@Artyon
@Artyon Год назад
Thank you Bro!
@Dunith_Munasinghe
@Dunith_Munasinghe Год назад
Thank you ❤️
@Abzarad
@Abzarad Месяц назад
thanks Bro
@Uberdurden
@Uberdurden 8 месяцев назад
best of best
@sorrybabyx
@sorrybabyx Год назад
Thank you
@frizz6779
@frizz6779 Год назад
Beo ur the best.
@Peyman13822
@Peyman13822 5 месяцев назад
thank you
@MohyDev
@MohyDev Год назад
I have always believed that education is the ultimate code to crack. Thanks to Bro Code, I have been able to unlock some of the most complex programming languages and computer science concepts with ease. Your videos have been instrumental in helping me level up my skills. So, from the bottom of my heart (and stack), thank you for being the best educational channel out there. Keep up the good work, Bro Code! Your dedication to educating the masses about programming languages and computer science has been truly inspiring. I would love to connect with you and learn more about your journey and how you became one of the best educational channels out there. again, thank you for being a constant source of knowledge and inspiration for us all. You're the real MVP, Most Valuable Programmer
@mohammadamanatalikhan
@mohammadamanatalikhan 6 месяцев назад
why is your comment there on every single video of brocode?
@lordender_kitty_official
@lordender_kitty_official 4 месяца назад
in java you can write && as well as || in the condition to check if multiple conditions are met or if one or the other of multiple conditions are met. does python have that kind of thing as well or would you have to do something like nesting if statements?
@angelica1010
@angelica1010 3 месяца назад
you are the goatttt
@aryansharma3189
@aryansharma3189 Год назад
age = int(input("What is your age: ")) if age >= 18: print("You are an adult") elif age == 17: print("come back next year") else: print("you are underage")
@troyebeyonce
@troyebeyonce 4 месяца назад
do you have any idea how to get the input line to check the condition of if else statements
@quyha1936
@quyha1936 Год назад
Love u so much ❤
@bekturasanbekov1979
@bekturasanbekov1979 11 месяцев назад
thx 4 vid bro !
@Belalrazaa
@Belalrazaa Год назад
i love u bhai❤
@fatihaltun4763
@fatihaltun4763 Год назад
Bro can you do this series for html css and web programming. It would be so beneficial for me
@NotTheHeroStudios
@NotTheHeroStudios Год назад
he has one, full HTML / CSS and a javascript to go with it
@fatihaltun4763
@fatihaltun4763 Год назад
@@NotTheHeroStudios thanks for answer
@narcissenasdepago5017
@narcissenasdepago5017 Год назад
Now it is clear
@phonezriend
@phonezriend Год назад
hey bro. Can you teach me depth first search and breadth first search in Python?
@aryansharma3189
@aryansharma3189 Год назад
# 1 United States Dollar equals = 81.49 Indian Rupee enterrupee = float(input("How many dollars do you want to convert into rupee: ")) onedollar = enterrupee * 81.55 print("Answer is" + " " + str(onedollar)) this is a dollar to rupee converter :>
@naphtalifurst4045
@naphtalifurst4045 Год назад
hi bro can you explain how to program a pid control for a spike prime robot? thx p.s can you reply to my comment?
@traderhacker-k346
@traderhacker-k346 3 месяца назад
Ure a goat straight to the point
@NTC-SClydeDianzonMoreno
@NTC-SClydeDianzonMoreno 2 месяца назад
the one i've been searching not here what if it's something like if (num >12 - 15) print("the number is between 12-15")
@openyourmind5534
@openyourmind5534 9 месяцев назад
you can also do! elif age != 18 print("You are to young!")
@reinholdkambata6444
@reinholdkambata6444 8 месяцев назад
🎩 off to Bro Code..
@usuario._.
@usuario._. 7 месяцев назад
print("Love u Bro Code☻♥")
@bloxfruits12346
@bloxfruits12346 3 месяца назад
print("u saved my life")
@omid1442
@omid1442 3 месяца назад
bri saves the day
@muthyala724
@muthyala724 Год назад
print type(type(int))) what is input please tell me ?
@toastyt0es
@toastyt0es Год назад
Input is what allows you to add your age in this example.
@htg7127
@htg7127 Месяц назад
money = 288 print("Current Money: 288$") x = int(input("How much money do you want to withdraw from a bank?")) if x > 288: print("You cant withdraw more money than you have.") if x
@velpr22
@velpr22 10 месяцев назад
2:02 thats what that website said💀
@baharehkjani6761
@baharehkjani6761 Год назад
PLEASE do function and return please please please
@alyxparr4913
@alyxparr4913 Год назад
My if/else code seems broken! I am still Bi-Polar!!!!! Help, please!!
@sainishantbiradar8022
@sainishantbiradar8022 3 месяца назад
For the algo
@johnfelix.
@johnfelix. Год назад
Guys try this! age = int(input("How old are you... BOI? ")) def age_questionary(): if age >= 100: print("OMG LMAO! Alright gramps you're signed up. Have fun old man.") elif age >= 18: print("Congrats! You're good to go... BOI. ") elif age < 0: print("You're kidding right? ") else: print("oh come on... YOU NEED TO BE 18+ TO SIGN UP YOU ANIMAL!!! ") print("GET LOST PETER PAN!") age_questionary()
@PSIwolf39
@PSIwolf39 5 месяцев назад
Here's some code I made with if/elif/else statements in python: import math children = int(input("How many children do you have?: ")) if children == 0: print("Haven't you been married for 19 years?") elif children > 9: print("May God bless you!") elif children > 4: print("That's quite a few kids you got there.") elif children < 0: print("NO YOU DON'T!") else: print(f"Nice, I have {children} kids too!")
@franzhuber6518
@franzhuber6518 3 месяца назад
Import math is useless
@Curious_Clover
@Curious_Clover 2 месяца назад
Correct me if I'm wrong but Java if ( _condition_ ) { _Code_ } Python if _condition_ : _Tab_ _Code_
@Espeque
@Espeque 8 месяцев назад
#Simple account login name = input("Enter your name: ") if name == "": print("Invalid response") print("Must be 18+ to join") age = int(input("Enter your age: ")) if age >= 125: print("Invalid response") elif age >= 18: print(f"Name: {name}") print(f"Age: {age}") elif age < 0: print("Invalid response") else: print("You are not old enough") response = input("Is the information above correct? (Y/N): ") if response == "Y": print("Account Confirmed") elif response == "N": print("Restart") else: print("Invalid response")
@WilliamMcDaniel-nr1nx
@WilliamMcDaniel-nr1nx Год назад
GLife
@abdulhannan-18
@abdulhannan-18 7 месяцев назад
True False tuc = True #Available if tuc: #Coz this condition is true so it will print the intended text. print("It is available.") else: print("Not available!") It is available tuc = False #Not Available if tuc: #Coz this condition is false so it will print the else part. print("It is available.") else: print("Not available!") Not available! online = True if online : #Coz this condition is true so it will print the intended text. print("You are online") else: print("You are offline") You are online online = False if online : #Coz this condition is false so it will print the else. print("You are online") else: print("You are offline") You are offline
@niceballz243
@niceballz243 Год назад
I have a prom today, this is a typical conversation that will occur many times. anwser = input("Bro are you drinking?: ") if anwser.lower() == "yes": a = input("Vodka or beer?: ") if a.lower() == "vodka": print("Good choice man") print("*Passes you the bottle* ") if a.lower() == "beer": print("Are you serious man?:") elif anwser.lower() == "no": you_sure = input("Are you sure? YOU WON'T DRINK WITH ME??? : ") if you_sure.lower() == "i will": a = input("That's a good choice, you want beer or vodka?: ") if a.lower() == "vodka": print("Good choice man") print("*Passes you the bottle* ") if a.lower() == "beer": print("Are you serious man?:") if you_sure.lower() == "no": print("Damnit go to hell.") else: print("You are wasted already")
@BahoraAvazova
@BahoraAvazova 4 месяца назад
thank you bro
Далее
Math in Python is easy + exercises 📐
13:51
Просмотров 86 тыс.
Python lists, sets, and tuples explained 🍍
15:06
Просмотров 232 тыс.
Stray Kids "ATE" TIMETABLE
00:13
Просмотров 134 тыс.
5 Good Python Habits
17:35
Просмотров 377 тыс.
Control Flow in Python - If Elif Else Statements
16:08
Просмотров 283 тыс.
While loops in Python are easy ♾️
6:58
Просмотров 312 тыс.
Functions in Python are easy 📞
10:38
Просмотров 396 тыс.
The if-elif-else Statement in Python
12:45
Просмотров 21 тыс.