This week we cover controlling program flow with the conditionals If, Else and Elif! Please leave me a comment or question below! Like and Subscribe to show …

source

33 Comments

  1. x=2000
    y=1500
    noob=["sword","shield"]
    if (x*3)>(y*4):
                 noob.append("500 health")
    else:
                 noob.pop(1)

    noob
    ["sword"]

    thanks for your teachings, the noob lost his shield 🙁

  2. thanks for the easy to follow tutorial.
    i was trying outside the scope of what you have provided but have this scenario:

    >>> if 100 or 99 < 22:
    print ('yep')
    else:
    print ('nope')

    yep

    >>> if (100) or (99 < 22):
    print ('yep')
    else:
    print ('nope')

    yep

    where did i go wrong with the "or" ? i tried "and" , it worked. using 3.6.1 . thanks again.

  3. At the 3:37 time mark, I do not understand how "mail time" was triggered. "if mail" was typed, but I am wondering when there was a "trigger" event which it checked for. I mean, when was "mail" read by python? What was the check which triggered the print?

  4. can someone tell me what's wrong ?
    example program:

    inp = input("Are you alive? ")

    if inp == "yes" or "sure":
    print("Nice")
    elif inp == "no" or "sadly":
    print("Ok ;-;")
    else:
    print("What?")

    And for some reason i can respond anything and will print the "Nice", but it works nice if i don't put the " or 'sure' "

  5. When I try to type else: "something" it says syntax error: invalid syntax.
    im using version 2.7.9, can someone help me?

  6. i know, i'm about three years late, but i have problem. when i'm typing that mail time thing it says "invalid syntax" when im typing else. any help?

  7. bro i am using Python 3.6
    ..some things are not matching in real time practice what to do shall i revert to 2.7?

  8. Loving this series. I did some very basic (Visual Basic and C++) programming nearly 20 years ago in high school, but got lost pretty easily in the beginning stages. This is helping me to understand the basics better and makes me eager to get beyond the beginner level. Thanks man!!

  9. how to get this work with 3.6.0, I can haz?:

    >>> if (7<6) and (4>3):
    print ('if')
    elif (7>6):

    SyntaxError: invalid syntax

  10. I'm using python 3.6.0, the if, else statements aren't working like they are in the video 🙁

    pete=3.6.0
    if (pete):
    print "too bad so sad, go get the right version for the video"
    else
    print "keep on learning with the video buddy"

    too bad so sad, go get the right version for the video

  11. If he is breathing and walking around than he is a zombie? That does not make sense, should it not be:
    if(walking):
    Alive
    elif(breathing):
    Alive
    else:
    Dead
    ?

  12. i wrote
    mail=0
    if mail:
    print 'mailtime'

    and it said the ending quotation mark was an invalid syntax please help

  13. Can anyone help me when i type
    mail = 5
    if mail:
    print("mail time")
    it says indentation error and im using python version 2.7.12

  14. How do I search for a word in a function?

    def question():
    q1 = input("Hello?")

    screen=["display","screen","black","cracked","blank"]

    question()

    for word in screen:
    if any word in question:
    print("Yes")
    else:
    print("No.")

    This doesn't seem to work.

Leave A Reply

Please enter your comment!
Please enter your name here