Skip to main content
Remove unnecessary "EDIT" (see https://meta.stackoverflow.com/q/255644/2745495);
Source Link
Gino Mempin
  • 30.5k
  • 31
  • 125
  • 174

asAs mentioned in the comment, if you introduce a conditional statement in pythonPython, you must have some kind of statement after it. This can be a "dummy" statement like pass, but it cannot be a comment (they don't count).

Examples:

x = 5

if x > 4:   # GOOD
    print('bigger than 4')

if x > 4:   # GOOD
    pass

if x > 4:   # ERROR
    # a comment

EDIT:

Try thisthe following code. YouYou had 2 locations where you had a conditional without a following line. BeBe sure to QAcheck the line numbers whenwhere you getare getting errors. Note that I commented out clear() because it is not defined

import time

def airlock(inventory):
  #clear()
  userin = None
  inventory["note"] = "your astronaut ID is: 2579"
  while userin != "quit":
    time.sleep(1.5)
    print("description of airlock, keypad on wall next to door")
    print("what u wanna do? 1 look around 2 check pockets 3 go to keypad")
    userin = input()
    
    if userin == "1":
      pass
      #describe the keypad. there is nothing else in the room
      
    elif userin == "2":
      invinspect(inventory)

def invinspect(inventory):
  userin = None 
  print(inventory.keys())
  print("what would you like to do? 1. look closer 2 go back")
  userin = input()
  if userin == 1:
    print(str(inventory))
  else:
    pass
    
  
def main():
  inventory = {}
  airlock(inventory) 

main()

as mentioned in the comment, if you introduce a conditional statement in python, you must have some kind of statement after it. This can be a "dummy" statement like pass, but it cannot be a comment (they don't count).

Examples

x = 5

if x > 4:   # GOOD
    print('bigger than 4')

if x > 4:   # GOOD
    pass

if x > 4:   # ERROR
    # a comment

EDIT:

Try this. You had 2 locations where you had a conditional without a following line. Be sure to QA the line numbers when you get errors. Note that I commented out clear() because it is not defined

import time

def airlock(inventory):
  #clear()
  userin = None
  inventory["note"] = "your astronaut ID is: 2579"
  while userin != "quit":
    time.sleep(1.5)
    print("description of airlock, keypad on wall next to door")
    print("what u wanna do? 1 look around 2 check pockets 3 go to keypad")
    userin = input()
    
    if userin == "1":
      pass
      #describe the keypad. there is nothing else in the room
      
    elif userin == "2":
      invinspect(inventory)

def invinspect(inventory):
  userin = None 
  print(inventory.keys())
  print("what would you like to do? 1. look closer 2 go back")
  userin = input()
  if userin == 1:
    print(str(inventory))
  else:
    pass
    
  
def main():
  inventory = {}
  airlock(inventory)
main()

As mentioned in the comment, if you introduce a conditional statement in Python, you must have some kind of statement after it. This can be a "dummy" statement like pass, but it cannot be a comment (they don't count).

Examples:

x = 5

if x > 4:   # GOOD
    print('bigger than 4')

if x > 4:   # GOOD
    pass

if x > 4:   # ERROR
    # a comment

Try the following code. You had 2 locations where you had a conditional without a following line. Be sure to check the line numbers where you are getting errors. Note that I commented out clear() because it is not defined

import time

def airlock(inventory):
  #clear()
  userin = None
  inventory["note"] = "your astronaut ID is: 2579"
  while userin != "quit":
    time.sleep(1.5)
    print("description of airlock, keypad on wall next to door")
    print("what u wanna do? 1 look around 2 check pockets 3 go to keypad")
    userin = input()
    
    if userin == "1":
      pass
      #describe the keypad. there is nothing else in the room
      
    elif userin == "2":
      invinspect(inventory)

def invinspect(inventory):
  userin = None 
  print(inventory.keys())
  print("what would you like to do? 1. look closer 2 go back")
  userin = input()
  if userin == 1:
    print(str(inventory))
  else:
    pass
    
  
def main():
  inventory = {}
  airlock(inventory) 

main()
added 1149 characters in body
Source Link
AirSquid
  • 12k
  • 2
  • 11
  • 40

as mentioned in the comment, if you introduce a conditional statement in python, you must have some kind of statement after it. This can be a "dummy" statement like pass, but it cannot be a comment (they don't count).

Examples

x = 5

if x > 4:   # GOOD
    print('bigger than 4')

if x > 4:   # GOOD
    pass

if x > 4:   # ERROR
    # a comment

EDIT:

Try this. You had 2 locations where you had a conditional without a following line. Be sure to QA the line numbers when you get errors. Note that I commented out clear() because it is not defined

import time

def airlock(inventory):
  #clear()
  userin = None
  inventory["note"] = "your astronaut ID is: 2579"
  while userin != "quit":
    time.sleep(1.5)
    print("description of airlock, keypad on wall next to door")
    print("what u wanna do? 1 look around 2 check pockets 3 go to keypad")
    userin = input()
    
    if userin == "1":
      pass
      #describe the keypad. there is nothing else in the room
      
    elif userin == "2":
      invinspect(inventory)

def invinspect(inventory):
  userin = None 
  print(inventory.keys())
  print("what would you like to do? 1. look closer 2 go back")
  userin = input()
  if userin == 1:
    print(str(inventory))
  else:
    pass
    
  
def main():
  inventory = {}
  airlock(inventory)
main()

as mentioned in the comment, if you introduce a conditional statement in python, you must have some kind of statement after it. This can be a "dummy" statement like pass, but it cannot be a comment (they don't count).

Examples

x = 5

if x > 4:   # GOOD
    print('bigger than 4')

if x > 4:   # GOOD
    pass

if x > 4:   # ERROR
    # a comment

as mentioned in the comment, if you introduce a conditional statement in python, you must have some kind of statement after it. This can be a "dummy" statement like pass, but it cannot be a comment (they don't count).

Examples

x = 5

if x > 4:   # GOOD
    print('bigger than 4')

if x > 4:   # GOOD
    pass

if x > 4:   # ERROR
    # a comment

EDIT:

Try this. You had 2 locations where you had a conditional without a following line. Be sure to QA the line numbers when you get errors. Note that I commented out clear() because it is not defined

import time

def airlock(inventory):
  #clear()
  userin = None
  inventory["note"] = "your astronaut ID is: 2579"
  while userin != "quit":
    time.sleep(1.5)
    print("description of airlock, keypad on wall next to door")
    print("what u wanna do? 1 look around 2 check pockets 3 go to keypad")
    userin = input()
    
    if userin == "1":
      pass
      #describe the keypad. there is nothing else in the room
      
    elif userin == "2":
      invinspect(inventory)

def invinspect(inventory):
  userin = None 
  print(inventory.keys())
  print("what would you like to do? 1. look closer 2 go back")
  userin = input()
  if userin == 1:
    print(str(inventory))
  else:
    pass
    
  
def main():
  inventory = {}
  airlock(inventory)
main()
Source Link
AirSquid
  • 12k
  • 2
  • 11
  • 40

as mentioned in the comment, if you introduce a conditional statement in python, you must have some kind of statement after it. This can be a "dummy" statement like pass, but it cannot be a comment (they don't count).

Examples

x = 5

if x > 4:   # GOOD
    print('bigger than 4')

if x > 4:   # GOOD
    pass

if x > 4:   # ERROR
    # a comment