+ 2

Hi. Can someone please correct this code for me: print ('The sum is' 1 + 2)

I need the output to be: The sum is 3

24th Jan 2022, 5:32 PM
K Deshpande
4 Réponses
+ 1
print('The sum is', 1+2)
24th Jan 2022, 5:35 PM
Jayakrishna 🇮🇳
+ 1
24th Jan 2022, 5:36 PM
K Deshpande
+ 1
You can do in other ways : print('The sum is', 1+2) #printing multiple values by space separated print('The sum is '+str(1+2)) #forming a string and printing. Because str+int is error.. Not allows print(f'The sum is {1+2}') #farmatted string You're welcome...K Deshpande
24th Jan 2022, 5:42 PM
Jayakrishna 🇮🇳
+ 1
That's really helpful Jayakrishna🇮🇳
24th Jan 2022, 5:44 PM
K Deshpande