Sam
Sam

Reputation: 43

How do I input a number and make that number display a symbol that amount of times?

I am trying to make a program which takes a number as input, and the outputs this many as # symbols. I got as far as -

Hash = input(“Enter a number? “)

But I dont know how to use that input to display the # that many times. E.g.

Enter a number? 6
(printed)######

Can anyone tell me how I can do this?

Upvotes: 0

Views: 299

Answers (3)

Freaky
Freaky

Reputation: 1

Remember to indent this properly You can use:

Hash=int(input("Please enter a number: "))  
for each in hash:  
    print("#")

Upvotes: 0

Vibhutha Kumarage
Vibhutha Kumarage

Reputation: 1399

This simple code will give the result you want. n=int(input(“Enter a number? “)) print('#'*n)

Upvotes: 0

Shai
Shai

Reputation: 114816

If you need to print n times the symbol #:

print('#'*n)

Upvotes: 2

Related Questions