-1

user_word and user_number are read from input. Output user_word, followed by ',' (a comma) and user_number using a single statement. Ex: If the input is: Amy 5 then the output is: Amy,5

user_word = input()
user_number = int(input())

print(user_word +",",user_number)

error is Output is nearly correct, but whitespace differs. See highlights below. Special character legend Your output Amy, 5 Expected output Amy,5

Output is nearly correct, but whitespace differs. See highlights below. Special character legend Your output Amy, 5 Expected output Amy,5

im getting a space between and when i try to concatenate is says i get another error

1st week 0 experience please help

Derek O
  • 16,770
  • 4
  • 24
  • 43

2 Answers2

0

Try f strings:

print(f"{user_word},{user_number}")
Greg Cowell
  • 677
  • 5
  • 16
0

By default print() function has a separator " ". That means print('abcd', 'xyz') will actually print 'abcd xyz'. Here we can manually set the separator by mentioning the 'sep' parameter in print() function.

For examples,

INPUT : print('abcd', 'xyz', sep='-')
OUTPUT: abcd-xyz

INPUT : print('abcd', 'pqrs', 'xyz', sep=',')
OUTPUT: abcd-pqrs-xyz

INPUT : print('abcd', 'xyz, sep='*')
OUTPUT: abcd,xyz

INPUT : print('abcd', 'xyz', sep='')
OUTPUT: abcdxyz

INPUT : print('abcd', 'pqrs', 'xyz', sep='')
OUTPUT: abcdpqrsxyz

In your case you should write print(user_word +",",user_number, sep='')