-3

Something like this

Underscores = int(input("Enter a number: "))
print("^" + Underscores + "^")

That's what I tried to do but it's not working, you might understand what I'm trying to do from that code. Basically, the user inputs how many "" They want in a "^^" emoji, such as if the input is 4, it prints out "^____^". If the input is 10, it prints out "^__________^" etc, thanks!

I've only tried this code so far, and looking through other sources online

Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
OpBanana
  • 53
  • 4

1 Answers1

2

You are close. You can multiply strings in python so:

'_' * 4

gives you:

'____'

With that you only need a slight change to your code:

n = int(input("Enter a number: "))
print("^" + '_' * n  + "^")

# or maybe cleaner:
print("^{}^".format("_" * n))
Mark
  • 90,562
  • 7
  • 108
  • 148