-6
name = input('Enter your name: ')

if len(name) <= 3:
    print ('Hi', name, ', you have a short name.') 
else:
    print('Hi', name, ', you have a long name.')
101
  • 8,514
  • 6
  • 43
  • 69
St ian
  • 1
  • 2
  • 2
    It looks like you already have a comma next to a variable. – 101 Jul 26 '18 at 06:21
  • 1
    When i run it, this is my answer: Enter your name: ian Hi ian , you have a short name. and i want to move the comma back one space – St ian Jul 26 '18 at 06:22
  • Another option is to use the `sep` arg of `print`, eg `print('Hi ', name, ', you have a short name.', sep='')`. And in Python 3.6+ you can use an f-string to do the formatting: `print(f'Hi {name}, you have a short name.')`. – PM 2Ring Jul 26 '18 at 06:35

3 Answers3

0

Why don't you use format?

print("Hi {}, you have a short name".format(name))
Sushant
  • 3,499
  • 3
  • 17
  • 34
0

You should try using the 'format' function:

print('Hey {name}, you have a nice name'.format(name=name))
john
  • 11
-2

You could you the plus operator where-ever you don't need any space.