Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAmanda DelCore
361 PointsSyntax error with division problem
I'm using the terminal to practice along, and just defining favorite_number = 42 makes python think it's a string or integer, so I get a syntax error when I try to do the division problem. Defining the variable as 42.0 lets it know it's a floating point, and then it will complete the division problem. Is that right, or is there a better way to do it?
2 Answers
Steven Parker
231,269 PointsI would not expect Python to think 42 was a string unless you put quotes around it. Maybe the question would make more sense if you show all of the code.
Amanda DelCore
361 Pointsgot it, thanks! Looks like I did have quotes around it by accident