Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Expresiones Condicionales | Declaraciones Condicionales
Introducción a Python

Desliza para mostrar el menú

book
Expresiones Condicionales

12345678
# Stock level of an item stock_level = 15 # Simple `if`/`else` to check stock levels if stock_level < 20: print("Stock is low") else: print("Stock is okay")
copy
12345678910
# Initial conditions totalCost = 150 # Applying discounts based on purchase amount if totalCost >= 200: print("20% discount applied") elif totalCost >= 100: print("10% discount applied") else: print("No discount for purchases under $100")
copy
1234567891011121314151617
# Initial conditions product = 'Non-Perishable' stock = 70 # Determine the handling of products based on type and condition if product == 'Perishable': if daysDelivered >= 4: print("Not fresh - Initiate discount") else: print("Product is fresh") elif product == 'Non-Perishable': if stock > 100: print("Consider discount") else: print("No discount needed") else: print("The product is not specified")
copy
Tarea

Swipe to start coding

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 5
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

close

Awesome!

Completion rate improved to 2.17

book
Expresiones Condicionales

12345678
# Stock level of an item stock_level = 15 # Simple `if`/`else` to check stock levels if stock_level < 20: print("Stock is low") else: print("Stock is okay")
copy
12345678910
# Initial conditions totalCost = 150 # Applying discounts based on purchase amount if totalCost >= 200: print("20% discount applied") elif totalCost >= 100: print("10% discount applied") else: print("No discount for purchases under $100")
copy
1234567891011121314151617
# Initial conditions product = 'Non-Perishable' stock = 70 # Determine the handling of products based on type and condition if product == 'Perishable': if daysDelivered >= 4: print("Not fresh - Initiate discount") else: print("Product is fresh") elif product == 'Non-Perishable': if stock > 100: print("Consider discount") else: print("No discount needed") else: print("The product is not specified")
copy
Tarea

Swipe to start coding

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

close

Awesome!

Completion rate improved to 2.17

Desliza para mostrar el menú

some-alt