#!usr/bin/python
listofnames = []
names = input("Pls enter how many of names:")
x = 1
for x in range(0, names):
inname = input("Enter the name " + str(x))
listofnames.append(inname)
print listofnames
error
inname = input("Enter the name " + str(x))
File “”, line 1, in
NameError: name ‘Jhon’ is not defined
inputgets text from the user which is then interpreted as Python code (hence it’s trying to evaluate the thing you entered,Jhon). You needraw_inputfor both of them and you’ll need to convert the number entered (since it’s a string) to an integer for yourrange.