0

What is False?!?! Why "else" is a Invalid Syntax?!?!

import random import socket guest = "" password = "Joker-Tool" print("This is Joker-Tool coded by Joe or CMD") while guest != password: guest = input("\nPlease enter a password to use this Tool: ") if guest == password: print("\nSucces!") print("\n~") print("\nOptions: [1] Random Love, [2] Playing Bone, [3] IPGETTER, [4] Calc") x = input("Select your option, please: ") if x == ("1"): list = ["Nava", "Paula", "Lou"] print("You love " + random.choice(list)) elif x == ("2"): nums = ["1", "2", "3", "4", "5", "6"] print("Your number is: " + random.choice(nums)) elif x == ("3"): print("\n Welcome! \nThis is a IPGETTER. The Most speedfull app for check the IP of Host") print("\n***************************CMD******************************") y = input("\nEnter Hostname: ") hostname = y IP = socket.gethostbyname(y) print("Succes!") print(IP) else: print("Eror")

27th Sep 2018, 4:47 PM
Joe
Joe - avatar
7 Antworten
0
i guess you have indented the else, it must be on the beginning of the line to not throw an invalid syntax error
27th Sep 2018, 5:00 PM
Kevin Dietrichstein
Kevin Dietrichstein - avatar
0
how?
27th Sep 2018, 5:01 PM
Joe
Joe - avatar
0
import random import socket guest = "" password = "Joker-Tool" print("This is Joker-Tool coded by Joe or CMD") while guest != password: guest = input("\nPlease enter a password to use this Tool: ") if guest == password: print("\nSucces!") print("\n~") print("\nOptions: [1] Random Love, [2] Playing Bone, [3] IPGETTER, [4] Calc") x = input("Select your option, please: ") if x == ("1"): list = ["Nava", "Paula", "Lou"] print("You love " + random.choice(list)) elif x == ("2"): nums = ["1", "2", "3", "4", "5", "6"] print("Your number is: " + random.choice(nums)) elif x == ("3"): print("\n Welcome! \nThis is a IPGETTER. The Most speedfull app for check the IP of Host") print("\n***************************CMD******************************") y = input("\nEnter Hostname: ") hostname = y IP = socket.gethostbyname(y) print("Succes!") print(IP) else: print("Eror") so?
27th Sep 2018, 5:01 PM
Joe
Joe - avatar
0
the print("Error") has to be indented and it should work
27th Sep 2018, 5:09 PM
Kevin Dietrichstein
Kevin Dietrichstein - avatar
0
but how?
27th Sep 2018, 5:09 PM
Joe
Joe - avatar
0
i try it, but it NOT functions(((
27th Sep 2018, 5:13 PM
Joe
Joe - avatar
0
how should i write it???
27th Sep 2018, 5:36 PM
Joe
Joe - avatar