If / Else
Link to Replit (fork it to duplicate)
Example
name = input("What is your name? ")
if name == "Ben":
print("Hello Ben")
else:
print("Your name is not Ben")
Summary
The video explains how to use if-else statements in Python. The instructor demonstrates how to set up conditions using if and else, with code examples. They show how to prompt user input, assign variables, and use conditional statements to execute specific code blocks based on the input. The video highlights the importance of indentation in Python to indicate code blocks. The instructor showcases a simple program that greets the user differently based on their input. Overall, the video provides a clear and practical introduction to using if-else statements in Python for decision-making in programming.