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
  • 171
  • 1
  • 4
  • 12

2 Answers2

6
def hashes(n):
    print "#" * n
kindall
  • 178,883
  • 35
  • 278
  • 309
1

With print function

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