!!HELP!!How can do so, that when i give "1" it fives only "You love...", without "NameError"??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

!!HELP!!How can do so, that when i give "1" it fives only "You love...", without "NameError"???

import random import socket list = ["Nava", "Paula", "Lou"] guest = "" password = "Joker-Tool" print(" Welcome! This is Joker-Tool coded by Joe(CMD)") while guest != password: guest = input("\nEnter Password to use this Tool: ") if guest == password: print("Succes!") else: print("False Password! Please try again!!!") print("\nSelect Option \n[1] Random Love \n[2] IpGetter \n[3] Say-Bot") h = input("\nSelect: ") if h == "1": print("\nYou love " + random.choice(list)) elif h == "2": print(" Welcome! \nThis is a IPGETTER. The Most speedfull app for check the IP of Host's\n***************************CMD******************************") x = input("\nEnter Hostname: ") hostname = x IP = socket.gethostbyname(x) print("Succes!\n" + IP) elif h == "3": print("This is Say-Bot") y = input("\nPrint anyone Greeting (ex.Hi): ") if y == "Hello" or "Hi" or "Ciao": print("Hi. How are u?") else: print("Error")

28th Sep 2018, 3:24 PM
Joe
Joe - avatar
1 Answer
0
you cant name a list "list",it is a python function to convert an object to a list. if you change the name it should work
28th Sep 2018, 7:49 PM
gil gil