Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
It is really strange that when in my code, when I make the line, that asks about number of tickets user wanna buy : t_request = input("How many tickets would you like to buy? ") t_request = int(t_request)
... and when I start playing around it and type some random float number instead of an integer, lets say (4.5), It pops out ValueError for me when python runs the code, but when I do the exact same thing in python shell - int(4.5), it outputs to me "4" as it should, without giving me any errors, I know that noone ever will type a float number in the t_request line, but I am really confused about why that happens.
Steven Parker210,440 Points
Since "t_request" is a string then, int(4.5) is not the "exact same thing".
The equivalent of int(t_request) would be int("4.5") (with quotes).