Learn Python • #4 Conditions • If / Else Statements

preview_player
Показать описание
Conditions (if/else statements) in Python let you control the flow of your program based on a set of rules.

By using if/else statements, you can create decision-making processes in your code that allow it to do different things depending on whether certain conditions are true or false. This is how you can create programs that can respond to user input and other dynamic situations.

This video is part of a beginner tutorial series for anyone who wants to learn Python from scratch, and get to a point where you can start coding your own projects.

🔗 Next Chapter: Coming Tomorrow!
👉 Follow me on Twitter: @pixegami

📚 Chapters
00:00 - "if" in Python
03:05 - "else" in Python
04:43 - "elif" in Python
06:52 - Inline Boolean Expressions
09:01 - Coding Exercise: Conditions
Рекомендации по теме
Комментарии
Автор

Thank you for this amazing tutorial. It really helped me!

Flyingturtle
Автор

How are you importing emojis without importing the emoji module?

bryansailer
Автор

print("Hello! You can check your ticket price.")
age = int(input("What is your age: "))
is_student = input("Are you a student (yes/no): ")

if is_student == 'yes':
is_student = True
else:
is_student = False

if age < 18:
print('Price is $0, FREE')
elif age > 65 or is_student == True:
print('Discount is 50%')
else:
print('You have to pay the full price')

PrachiKotadia-wg
join shbcf.ru