1

I can print(‘#’*5) to >>> #####.

But if I try to do this with f-string like

a=5
print(f” ‘#’*{a}”) 

I get >>> ‘#’*5. Is this not possible, or what is my failure?

Aziz
  • 20,065
  • 8
  • 63
  • 69
Paul-ET
  • 68
  • 1
  • 6

1 Answers1

1

You can do:

a=5
print(f"{'#'*a}")

To get

#####
Aziz
  • 20,065
  • 8
  • 63
  • 69