Re: Telephone directory program in python Programming Software Development by Mansour_4 To save the name and phone use i/O FILE EX, Fi= open ("filename.text") elif error, i really have no clue where this is coming from Programming Software Development by gotm …== 5): print "White is the winner!" return True elif (whitePairCap == 5): print "Black is the winner!" …if (color == "b"): currentPlayers[p] = "black" elif (color == "w"): currentPlayers[p] = "white" inGameMenu… Re: elif error, i really have no clue where this is coming from Programming Software Development by gotm … = str(saveFile) if saveFile == "y": saveFileGame() elif saveFile == "n": newGame() #defining players and their colors… (color == "b"): currentPlayers[p] = "black" elif (color == "w"): currentPlayers[p] = "white" … Re: elif error, i really have no clue where this is coming from Programming Software Development by gotm …quot;White is the winner!" return True elif (whitePairCap == 5): print "Black is …[8],line[9]]) f.close() inGameMenu() elif saveFile == "n": newGame() …quot;b"): currentPlayers[p] = "black" elif (color == "w"): currentPlayers[p] = "… Re: elif error, i really have no clue where this is coming from Programming Software Development by Gribouillis [icode]elif[/icode] and [icode]else[/icode] must have the same indentation than the corresponding [icode]if[/icode]. Edit: sorry, in your code, the 2 lines before the elif should be indented like the for statement above. Re: elif error, i really have no clue where this is coming from Programming Software Development by woooee [QUOTE]Ugh I hate these elif errors![/QUOTE]Then don't use it. Some examples that … range(0, 10): row_dic[j] = [] ## ##------------------------------------------------------------------ """ instead of elif (player == "p2"):, etc. """ player_dic = {} player_dic… elif problem Programming Software Development by Russ775 …1: print("You are gonna die today") input() elif fortune == 2: print("You will find love") input…print("You will make it big today!") input() elif fortune == 4: print("You friends will betray you!&…quot;) input() elif fortune == 5: print("They are comming to find you… Re: elif problem Programming Software Development by JoshuaBurleson … == 1: print("You are gonna die today") elif fortune == 2: print("You will find love"… 3: print("You will make it big today!") elif fortune == 4: print("You friends will betray you!"…;) elif fortune == 5: print("They are comming to find you… elif structure Programming Software Development by tondeuse34 … and i try to use an elif statement and run the code, it say's 'elif' is an syntax error. Is it… way do you want to go(L,R,S)?: ") elif direction == 'L': print "You have gone left."[/CODE… Re: elif structure Programming Software Development by MitkOK …;) if direction == 'Left': print "You have gone left" elif direction == 'Right': print "You have gone right" else… "You have gone Straight" [/code] You indented "elif" in manner to check the first input [code="… Re: elif structure Programming Software Development by MitkOK Yes, it's indention problem. [code="python"] print "1) Play" if choice == 1: ways = ['L','R','S'] ways = raw_input("Which way do you want to go(L,R,S)?: ") elif direction == 'L': print "You have gone left." [/code] Re: elif structure Programming Software Development by tondeuse34 … way do you want to go('Left,Right,Straight)?: ") elif direction == 'Left': print "You have gone left"[/CODE… if / elif Programming Software Development by lewashby … self.boredom if unhappiness < 5: mood = "happy" elif 5 <= unhappiness <= 10: mood = "okay"… =="2": crit.eat() # play with your critter elif choice == "3": crit.play() # some unknown choice else:… Re: if / elif Programming Software Development by masterofpuppets …<= 10[/CODE] is the same thing as [CODE]elif 5 <= unhappiness and unhappiness <= 10[/CODE]…the input inside the while loop and all if..elif should be inside as well. Like this: […quot;2": crit.eat() # play with your critter elif choice == "3": crit.play() # some … Help with updating a list inside a elif clause and return the list Programming Software Development by anishxx323 …that the scores are being updated in the elif clause but once i get out the clause…scores has been cleared") elif option == 1: scores.append(addScores()) elif option == 2: printScores() elif option == 3: averageScores() … Re: if, else, elif.. newb. Programming Software Development by woooee …2: as the first if, and the following elif's should use and elif shipweight >2 and shipweight <6: … like a list. You eliminate a long string of elif, and you can simply modify the list to add/…change/delete weight catagories. (No additional elif necessary if another catagory is added.)[CODE]def shipping_charges(package_weight… if, else, elif.. newb. Programming Software Development by SitiSlicker …2: print 'Your total shipping charges: $2.10' elif: if shipweight>2 or shipweight<6: print… some random errors. but it always tells me 'elif' or 'else' are invalid syntax.. haha maybe … looking for a little clarification on the if, elif and else structure. Any constructive input is greatly … Help with if , elif statement Programming Software Development by rociel …start before and end before 9pm. payment =(end - start)*5 elif start <= 21 and end <= 3: # if … after = (24 + end)- 21 payment = 5* before + 3* after elif start <= 21 and end >= 21: # if start before… 9pm and end before midnight payment = 3*(24 - end) elif start >= 21 and end <= 3: # if … 'if - elif' not working Programming Software Development by novice20 …if(map_dict1[int(MIO_outports1[i])] == int(Exp_map_inport[i]) ): flag = 1 elif(map_dict2[int(MIO_outports1[i])] == int(Exp_map_inport[i])): flag = 1 else… [/CODE] But I am not able to navigate to the 'elif' part. I am getting : [CODE] if(map_dict1[int(MIO_outports1[… Re: if, else, elif.. newb. Programming Software Development by Gribouillis …] optionally followed by zero or more blocks like [code=python] elif expression: statements [/code] and finally zero ore only one block… a given if statement, the keywords "if", "elif" and "else" must have the same indentation… Re: if, else, elif.. newb. Programming Software Development by Stefano Mtangoo …>=2: print 'Your total shipping charges: $2.10' elif shipweight>2 or shipweight<6: print 'Your total… shipping charges: $3.20' elif shipweight>6 or shipweight<10: print 'Your total… Re: 'if - elif' not working Programming Software Development by novice20 thanks raptr_dflo, but what I say is the key is present in 'map_dict2' so, why is the control not getting passed to the 'elif' part,?? when key is not present in 'map_dict1' it should check 'map_dict2' right?? Re: 'if - elif' not working Programming Software Development by novice20 …) if(map_dict1[int(MIO_outports1[i])] == int(Exp_map_inport[i]) ): flag = 1 elif(map_dict2.has_key(int(MIO_outports1[i]))): if(map_dict2[int(MIO_outports1[i… if -elif-else statement not working Programming Software Development by monica23 Good day everyone, I need to print data using if-elif statement. I when I run this code like this, everything … row['username'] == 'mutago': print " okay" sys.exit(0) elif row['password']=='muta55': print "good" else: print "… Re: if -elif-else statement not working Programming Software Development by woooee The OP has it correct [quote]I need to print data using if-elif statement elif row['password']=='muta55':[/quote]. Possible to have two strings on one elif? Programming Software Development by Frensi … if it's possible to have two strings on one elif. Something like this. name = input("What is your full…;Jack Neilson": print("I like your name") elif name == "John Cleese", "Michael Palin": print… Python Help Invalid Syntax IF ELIF ELSE i think Programming Software Development by mbh1992 … ['name'] +' is not in the ' + resp # Test Print print(answ) elif qcode == 'population': resp = raw_input('What is the population of ' + record…'t if I just put an if instead of an elif, when I put that I get invalid syntax. Can anyone… Rookie mistake? If statement working, instead of elif Programming Software Development by ZJRG.1997 …'): dist_cent=float(input('measurement in centimeters: ')) print(dist_cent /2.54) elif type('b'): dist_inch=float(input('measurement in inches: ')) print(dist_inch…. But if the user inputs 'b', instead of running the 'elif' statement, it runs the first 'if' statement as if the… my if/elif wont work Programming by kesh123 …) or user in (choice1): print("password is weak") elif user in choice2 and choice1 or user in choice and… choice and choice2: print("your password is medium") elif user in choice2 and choice1 and choice: print("your… if and elif and else Programming Software Development by kiyo_1 …; 5: print 'what the...how did you understand on me' elif age < 18: school = raw_input ('in wich school you are… ('what you work??') print "i don't care" elif ageelse == ('n' or 'N' or 'No' or 'no'): print "…