0

Here is where the error happened

print(f'Hey, {Username}, your password is {'*' * Password}. The password is **{len(Password)}** long.')
AvyChanna
  • 336
  • 5
  • 12
  • Does this answer your question? [Using quotation marks inside quotation marks](https://stackoverflow.com/questions/9050355/using-quotation-marks-inside-quotation-marks) – Tomerikoo Mar 02 '21 at 14:22
  • Does this answer your question? [Invalid syntax - Expression returning a string in f-String](https://stackoverflow.com/questions/53609639/invalid-syntax-expression-returning-a-string-in-f-string) – Gino Mempin Mar 02 '21 at 14:28

1 Answers1

1

That is because you are using single quote for main string as well as '*'.

Python interprets it as -

print( f'Hey, {Username}, your password is {'# string ends here.
*' * Password}. The password is **{len(Password)}** long.')

The last bracket goes unmatched and hence the error.

A quick fix would be to use double quotes in one of the strings.

print(f'Hey, {Username}, your password is {"*" * Password}. The password is **{len(Password)}** long.')
AvyChanna
  • 336
  • 5
  • 12