Why is "elif x == ("2"):" - IdentitationError??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is "elif x == ("2"):" - IdentitationError???

elif x == ("2"): 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)

28th Sep 2018, 5:33 AM
Joe
Joe - avatar
5 Answers
+ 1
People can't copy and paste text in questions so please link the code so we can look at it better
28th Sep 2018, 5:38 AM
Daniele Bonomi
Daniele Bonomi - avatar
+ 1
I think you didn't put any space before: y = input.... hostname = y IP = socke... print("Suc... print(IP)
28th Sep 2018, 5:42 AM
Daniele Bonomi
Daniele Bonomi - avatar
0
i havent publish it. i write it here
28th Sep 2018, 5:40 AM
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] IPGetter, [3] Random number") x = input("Select your option, please: ") while x == ("1"): list = ["Nava", "Paula", "Lou"] print("You love " + random.choice(list)) else: print("Error") elif x == ("2"): 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) elif x == ("3"): nums = ["1", "2", "3", "4", "5", "6"] print("Your number is: " + random.choice(nums)) else: print("Error")
28th Sep 2018, 5:40 AM
Joe
Joe - avatar
0
Joe Don't start with elif but if. If your editor can do this, highlight tabs or spaces. Maybe there is small difference, I can't find in the playground. Daniele Bonomi Are you using the App? Then you could copy and paste the code in question by tapping at the three dots on the upper right and "Copy Text"
28th Sep 2018, 7:06 AM
Matthias
Matthias - avatar