I am trying to get user input with error checking using a while loop to make sure the user always enters something with more than 2 characters. However the Python program never asks me for input. Help?
first_names = ['fred', 'bob', 'mary', 'john', 'frank', 'james', 'joe', 'jay']
last_names = ['jones', 'smith', 'doe', 'cardinal', 'jesus', 'watson', 'blogs', 'harris']
full_names = ['empty_name']*len(first_names)
i = 0
while True:
full_names[i] = (first_names[i] + " " + last_names[i])
print full_names[i]
i = i + 1
if i == (len(last_names) + len(first_names))/ 2:
True = not True
name = 'placeholder_name_for_user_input_via_console'
while True:
name = raw_input("please enter a new name")
if len(name) < 2 :
print " please enter a name longer than 2 characters"
else:
True = not True
print "thank you for entering a long name"
full_names.append(name)
print(full_names)
I'm using Python 2.7 if that makes any difference.
edit:
I fixed my code. After the first while loop = need to write True = not False to make it work.
True = not True...are you attempting to rip a hole in spacetime itself?!Truejust like you can't change the value of1