Problem witrh else and elif values. - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Problem witrh else and elif values. (/thread-256.html) Problem witrh else and elif values. - anolibal - Oct-03-2016 Hello there i am new into this programming world, and yesteday i was trying to apply the else and elif fonction without any success! I let you a pic down there to illustrate my problem. on this link you can find easily the screen shot i made for another trade : http://www.developpez.net/forums/d1604961/general-developpement/langages-programmation/probleme-python/ Anolibal. RE: Problem witrh else and elif values. - j.crater - Oct-03-2016 Bon jour! I don't know what exactly is the matter with your code, but I tried this and it worked: ```a = 150 if (a>5):    print("bigger") elif (a < 5):    print("smaller")```Next time just paste code and error message here, code being within code tags ;) RE: Problem witrh else and elif values. - sparkz_alot - Oct-03-2016 Also, you don't need the parenthesis in your 'if' and 'elif' statements: ```a = 150 if a > 100:    print('a is bigger') elif a < 100:    print('a is smaller')``` RE: Problem witrh else and elif values. - anolibal - Oct-03-2016 First of all thanks for your answeres guys ! But even if('i copy paste') you code it still doesn't work ! :( :( When i type elif or else python reconyze the function but when i type enter the red message appears agin and again :O That stuff is weird :D SOS ! Ano Oh dam yes i found the answere ! For those who are interested : after the command IF i say print something, and at this moment i press enter, and then the tiping line goes down. at this moment i want to type elif but it doesn't work and if i press enter again : >>> will appear again which means that python wait for a new command. So the thing to do is just to press left arrow once to align the IF , ELIF, and ELSE command so that python understand that THESE are answeres to the IF. ANOLIBAL RE: Problem witrh else and elif values. - nilamo - Oct-03-2016 You're trying to use if/elif interactively.  Which means you need to enter both before the next prompt (">>>"). ```Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> if "spam" == "eggs": ...   print("I doubt it.") ... elif "spam" in ["spam", "spam", "spam", "baked beans", "spam"]: ...   print("More likely.") ... More likely. >>>``` RE: Problem witrh else and elif values. - Skaperen - Aug-19-2018 as nilamo is describing, you ended the conditional structure before you intended to. place test code in a small file. make it test only one thing. then run it instead of using the interactive mode. long code is hard to work with in interactive because you probably have to type it again a few times. then it is easier to edit the file and run it again. RE: Problem witrh else and elif values. - DeaD_EyE - Aug-20-2018 [attachment=455] You hit two times enter, then this block was closed. In the next lines you tried to continue with your elif statement, but block was already closed. If you use the repl (interactive shell), two times ENTER finishes the block. Just hit only one time enter for the next line. RE: Problem witrh else and elif values. - Skaperen - Aug-20-2018 if you see "..." it is taking more input for the block. if you see ">>>" you are starting a block. maybe i need to start a course "Introduction to Python Language Interactive Mode 101" for the Freshmen to get them started.