将密码变成星号的方法是什么?

huangapple go评论96阅读模式
英文:

Is there a way to make a password into stars

问题

I am making a password checker but I want it to print out the passcode but in *.
My code is:

    username = input("What is your name?")
    password = input("What is your password?")
    
    password_length = len(password)
    
    print(f'{username}, your password, {password}, is {password_length} letters long')
英文:

I am making a password checker but I want it to print out the passcode but in *.
My code is:
username = input("What is your name?")
password = input("What is your password?")

password_length = len(password)

print(f'{username}, your password, {password}, is {password_length} letters long')

答案1

得分: 1

print(f'{username}, your password, {"*" * password_length}, is {password_length} letters long')

英文:
print(f'{username}, your password, {"*" * password_length}, is {password_length} letters long')

huangapple
  • 本文由 发表于 2023年3月4日 00:58:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75629895.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定