-2

I'm a noob at programming but I wanted the script to only accept alphabet inputs rather than numbers too. Especially only one alphabet. Thanks

for x in range (0, 90000):
("Type alphabet") 
cha1=input()
complete = choice(list1)

if (cha1) == (complete):
            print ("Try again")


if (cha1) != (complete):
    print (complete)
R khan
  • 15
  • 2
  • 1
    https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response will give you some hints about input validation. – Igl3 Jan 18 '18 at 14:18
  • 1
    try using `if cha1.isalpha()` – vineeth560 Jan 18 '18 at 14:18
  • In the future, please provide a minimal, complete, and verifiable example: https://stackoverflow.com/help/mcve – Nathan Werth Jan 18 '18 at 14:22
  • 1
    Possible duplicate of [Asking the user for input until they give a valid response](https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response) – glibdud Jan 18 '18 at 14:22

1 Answers1

0
if 'somestring'.isalpha():
    do_stuff()
Evan
  • 2,120
  • 1
  • 15
  • 20