Question: Write a Python function which will be called: KeyGen. The important function that must be performed is verifying that the chosen keyword contains no double
Write a Python function which will be called: KeyGen. The important function that must be performed is verifying that the chosen keyword contains no double letters. So HELLO and 111 are invalid keywords, but PIKACHU and ORANGE are valid. It may have the following psuedocode:
INPUT: None
OUTPUT: keyword
*****************************
def KeyGen ():
while True:
Ask user for keyword
Check if keyword has any repeated letters
If the keyword has no repeated letters:
return the keyword
Hint: You might want to use Python's count method. For instance, if a = 'foo' then a.count ('f') returns 1, while a.count ('o') returns 2. A keyword where the count of each letter in the keyword is 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
