Scribe
Scribe

¿Te gusta? Haz que Scribe sea aún mejor dejando una reseña

Obtener Extensión para Chrome

Explorar

  • Videos Populares
  • Videos Recientes
  • Todos los Canales

Herramientas Gratuitas

  • Descargador de Subtítulos de Video
  • Generador de Marcas de Tiempo de Video
  • Resumidor de Videos
  • Contador de Palabras de Video
  • Analizador de Títulos de Video
  • Búsqueda de Transcripciones de Video
  • Analíticas de Video
  • Creador de Capítulos de Video
  • Generador de Cuestionarios de Video
  • Chat con Video

Producto

  • Precios
  • Blog
  • Obtener Extensión para Chrome

Developers

  • Transcript API
  • API Documentation

Legal

  • Términos
  • Privacidad
  • Soporte
  • Mapa del sitio

Derechos de autor © 2026. Hecho con ♥ por Scribe

— Si esto hizo tu vida más fácil (o al menos un poco menos caótica), ¡déjanos una reseña! Prometemos que nos alegrará el día. 😊

Related Videos

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

Video thumbnail
126.22k1,098 Palabras5m readGrade 18
Compartir
Channel
Bro Code
hey everybody in this topic I'm going to explain if statements and if statement is used to do some code only if some condition we set is true else we could do something else it's a basic form of decision making if it's true we do something if it's not true we don't do it let's ask a user for their age age equals input enter your age I will type cast the input as an integer depending on what the user's age is we can do one of a few things let's pretend that the user would like to
sign up for a credit card but in order to do so their age needs to be greater than or equal to 18. well we can check that to use an if statement type if then some condition what would we like to check let's check to see if the user's age is greater than or equal to 18 then add a colon then hit enter any code underneath the if statement should be indented make sure to pay attention to that because that's easy to miss if the user's age is greater than or equal to 18 let's print
you are now signed up if I were to run this code I'll type in my age I'll type 21 hit enter this statement is true therefore we will execute any code found within the if statement you are now signed up what if this condition was not true let's say my age is 13. well nothing happens if the condition we check is instead false we skip over this code if you need to take a different course of action you could add an else statement if this is true do this else we can do something else let's
print a different message you must be 18 plus to sign up I'll type in my age again I'll say that I'm 13. hit enter you must be 18 plus to sign up that's basically an if statement do some code only if some condition is true else you could do something else entirely it's a basic form of decision making the else statement is kind of like a last resort we can check more than one condition before reaching the else statement we can add an else if statement which we just shortened to e-l-i-f meaning else if else
if let's check if age is less than zero then we'll print a different message you haven't been born yet now if I run this code I'll say that my age is negative one this condition is false we skip this code this condition is true therefore we will execute this code and we skip the else statement you haven't been born yet let's add another elsif statement you can add as many elsif statements as you want let's check to see if somebody's age is greater than or equal to 100 we'll print a different message let's print you
are too old to sign up if I were to say my age is 111 years old well it states you are now signed up the reason that we didn't reach this part of our elsif statement that's because this condition is still technically true you do need to pay attention to your order of if and else if statements if I want to be sure that nobody over 100 is signing up I should probably move this to the beginning if age is greater than or equal to 100 then else if age is greater than or equal to
18 we'll do something else and to your age I am 111 years old you are too old to sign up so those are if statements if some condition is true do something else if you can check something else if no above conditions are true you could do something else entirely it's kind of like the default here's another example we'll ask a user if they would like some food response equals input would you like food we'll have the user type in y for yes or n for no if our response now to check to see if
two values are equal you would use double equals if the response is equal to y then we will print have some food the doubles equal sign is the comparison operator it will check to see if two values are equal you don't want one equals because that's the assignment operator python in this case thinks we're attempting to assign the character y to response so for comparisons use double equals else we can print no food for you so would you like food I'll type why have some food let's try it again I'll type no and for no
no food for you here's a third example we'll have a user type in their name name equals input enter your name if our name is equal to an empty string that means they didn't type in anything so let's yell at the user you did not type in your name else we will print using an F string hello whatever the name is enter your name I'm just going to hit enter you did not type in your name let's run this again I'll type in my name and we have executed the else statement this time hello bro
so one important thing that you should know is the use of boolean's width if statements suppose we have some Boolean variable named for sale I'll set this to be true now using an if statement you can just use the Boolean variable in place of a condition because a condition would evaluate to be true or false we could just say if for sale if that's true then let's print this item is for sale else we will print this item is not for sale for sale is set to be true this item is for sale if this
variable were false well then the item is not for sale let's try a different variable how about online if online the user is online else the user is offline so the user is offline I'll change the Boolean to true the user is online so with if statements you can either write a condition or you could use a Boolean all right everybody so those are if statements do some code only if some condition is true else you can do something else it's a basic form of decision making and those are if statements in Python
Videos Relacionados
Let's code a simple python CALCULATOR! 🧮
5:52
Let's code a simple python CALCULATOR! 🧮
Bro Code
3,550 views
If Else Statements in Python // Python RIGHT NOW!! // EP 4
14:19
If Else Statements in Python // Python RIG...
NetworkChuck
404,191 views
For loops in Python are easy 🔁
5:06
For loops in Python are easy 🔁
Bro Code
292,854 views
Control Flow in Python - If Elif Else Statements
16:08
Control Flow in Python - If Elif Else Stat...
Programming with Mosh
292,685 views
Nesting “If Else” Can Seriously Damage Your Code Quality, Do THIS Instead In Python
8:25
Nesting “If Else” Can Seriously Damage You...
Indently
134,485 views
5 Good Python Habits
17:35
5 Good Python Habits
Indently
511,121 views
Please Master These 10 Python Functions…
22:17
Please Master These 10 Python Functions…
Tech With Tim
144,473 views
The if Statement in Python
18:25
The if Statement in Python
Neso Academy
14,153 views
Functions in Python are easy 📞
10:38
Functions in Python are easy 📞
Bro Code
457,353 views
While loops in Python are easy ♾️
6:58
While loops in Python are easy ♾️
Bro Code
346,849 views
#19 Python Tutorial for Beginners | If Elif Else Statement in Python
15:38
#19 Python Tutorial for Beginners | If Eli...
Telusko
1,352,005 views
Python for Data Analysis: Control Flow (if, else, for, while)
20:30
Python for Data Analysis: Control Flow (if...
DataDaft
14,940 views
Math in Python is easy + exercises 📐
13:51
Math in Python is easy + exercises 📐
Bro Code
99,560 views
The if-elif-else Statement in Python
12:45
The if-elif-else Statement in Python
Neso Academy
28,409 views
Type casting in Python is easy 💱
7:37
Type casting in Python is easy 💱
Bro Code
109,348 views
Python lists, sets, and tuples explained 🍍
15:06
Python lists, sets, and tuples explained 🍍
Bro Code
263,808 views
PLEASE Use These 5 Python Decorators
20:12
PLEASE Use These 5 Python Decorators
Tech With Tim
109,490 views
5 Useful Dunder Methods In Python
16:10
5 Useful Dunder Methods In Python
Indently
58,601 views
Python weight conversion exercise 🏋️
4:01
Python weight conversion exercise 🏋️
Bro Code
53,046 views