Skip to content

Instantly share code, notes, and snippets.

@Hossara
Last active January 7, 2022 14:18
Show Gist options
  • Save Hossara/9f394e887f69e9fbf0a4d9ac5ffcaf83 to your computer and use it in GitHub Desktop.
Save Hossara/9f394e887f69e9fbf0a4d9ac5ffcaf83 to your computer and use it in GitHub Desktop.
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