0
def hashes(n):
    for x in range(0, n):
    print"#",

The above code produces the following result if n = 5:

# # # # #

Could anyone suggest a solution for making the characters have no space in between?

i.e

#####

(Python 2.7)

Matt Walker
  • 169
  • 1
  • 4
  • 11

2 Answers2

6
def hashes(n):
    print "#" * n
kindall
  • 168,929
  • 32
  • 262
  • 294
1

With print function

from __future__ import print_function
def hashes(n):
    for x in range(0, n):
        print("#", end='')
P̲̳x͓L̳
  • 3,547
  • 3
  • 28
  • 37