crzcas

and-or operators

Dec 19th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. power = input("Is there electric power? on/off? ")
  2. internet = input("Is the internet modem connected? on/off? ")
  3. computer = input("Is the computer connected on/off? ")
  4. if (power == "on") and (internet == "on") and (computer == "on"):  
  5.     print ("You can surf the Internet" )
  6. elif (power == "off") and (internet == "on") and (computer == "on"):
  7.     print ("You need turn on the electric power")
  8. elif (power == "on") and (internet == "off") and (computer == "on"):
  9.     print ("You need turn on the internet modem")
  10. elif (power == "on") and (internet == "on") and (computer == "off"):
  11.     print ("You need turn on the computer" )
  12. elif (power == "off") or (internet == "off") or (computer == "off"):
  13.     print ("Please verify, you need turn on electric power, internet modem and the computer")
  14. else:
  15.     print("Please run again and type the correct options on/off")
  16.  
Advertisement
Add Comment
Please, Sign In to add comment