How do you concatenate string with float? If not, how do you print the interest amt. beside the sentence 'rate of int is' ?


2/11/2020 2:33:56 PM


4 Answers

New Answer


You can just include i in the print() call: (you don't need to convert numbers to strings in this case) print('rate of interest is: ',i)


Some other ways you can do the same with python: print('rate of interest is ' + str(i)) print('rate of interest is {}'.format(i)) print(f'rate of interest is {i}') The last trick is called string interpolation, also known as f-string in python, and my personal favorite method.


Thanks for the info! I'm still learning but I'll try my best to make the code as efficient as possible!


Thank you. I recently started python. I used JavaScript before that so I was trying print('rate of int is: ' + i).