[Solved]Why can't we directly use price variable in the print statement?


10/21/2019 3:33:03 PM


2 Answers

New Answer


Because price is an integer and you cannot concatenate an integer with a string. However you can use price directly in the print() function without converting it using f-string print(f"Your admission cost is $ {price}.")


Because Python does not want some type-conversions to happen out of the scenes.