+2

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

https://code.sololearn.com/cfN72OqN30zE/?ref=app

10/21/2019 3:33:03 PM

Subham

2 Answers

New Answer

+6

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}.")

0

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