Python 3.4 - If / Else Statement

Decisions, decisions. When someone clicks on something what does the program do? What if someone's age under for something? How do you get your program to make a decision and do something.

The variable is Bronte and the program is checking to see what the variable is and deciding what to do if the variable is something. 

I imagine for example a person choosing a username for a website and the program runs through it whole database of usernames quickly and if it matches with any of them it would print('choose another name, that one has already been taken'). If it isn't taken the else function would tell the program what do whatever else the case (i.e. print('username accepted, lucky')

name = 'Bronte'
if name is 'Matt':
    print('You da best')
elif name is 'Melanie':
    print("I'm the best")
else:
    print("meow")

/Users/mattfassnacht/PycharmProjects/untitled10/venv/bin/python /Users/mattfassnacht/PycharmProjects/untitled10/math.py
meow

Process finished with exit code 0

https://www.youtube.com/watch?v=bk22K1m0890

Comments

Popular posts from this blog

Python 3.4 - Caesar Cipher

UML - Use Case Diagram