Created
September 1, 2018 18:50
-
-
Save pknowledge/5bcc9c0446115ee7ac45478ee8d7aed9 to your computer and use it in GitHub Desktop.
Python Tutorial for Beginners-if..elif..else statements + nested IF statements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python Tutorial for Beginners-if..elif..else statements + nested IF statements | |
#------------nested IF statements-------- | |
x = 10 | |
if x >= 0: | |
print("x is positive ") | |
if (x%2) == 0: | |
print("x is even") | |
else: | |
print("x is odd") | |
else: | |
print("x is negative") | |
#-------------if..elif..else statements------------- | |
name = input("Enter a Name: ") | |
if name == "Max": | |
print("Name Entered is : ", name) | |
elif name == "Max": | |
print("Name Entered is : ", name) | |
elif name == "Roy": | |
print("Name Entered is : ", name) | |
elif name == "Eli": | |
print("Name Entered is : ", name) | |
else: | |
print("The Name entered is invalid") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment