Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
coding doesent work???
#1
hey all i am using python 3.3.3 in idle (i know its outdated) but i am trying to make a siple if statment however it wont work and says invalid syntax if i try to run it and highllights the word else. what have i done wrong?? here it is

print ("hello world")
myName = input("what is your name?")

if(myName == "Louis" or "louis"):
    print("Louis is so amazing")

    else print("you are ok")
thanks,Darbandiman123 Think LOL
Reply
#2
else needs to be indented to the same degree as its respective if. You have it indented too much. You're also missing a colon after else. Once those are resolved, I recommend you check out http://python-forum.io/Thread-Multiple-e...or-keyword
Reply
#3
Hello!
Use the python code tags, please!

print ("hello world")
myName = input("what is your name?")

if myName.lower() == "louis":
    print("Louis is so amazing")

else:
     print("you are ok")
You forgot ':' after else.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  my coding doesn't work plz help Darbandiman123 6 5,022 Feb-03-2017, 05:27 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020