Last active
January 7, 2022 14:18
-
-
Save Hossara/9f394e887f69e9fbf0a4d9ac5ffcaf83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
while(True): | |
name = str(input("Please Enter Your Name\n> ")) | |
print("\n") | |
name = name.lower() | |
temp = [] | |
letter = '' | |
state = 1 | |
for i in name: | |
if i in temp: | |
if letter == '' or letter == i: | |
letter = i | |
state = 2 | |
temp.append(i) | |
else: | |
state = 3 | |
temp.append(i) | |
else: | |
temp.append(i) | |
if state == 1: | |
print(name) | |
elif state == 2: | |
print(name.replace(letter, "*")) | |
else: | |
print("Equal Number Of Chars") | |
print("\n") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment