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 trialjayda hendrickson
3,413 Pointsnum1 & num2
Why did he not have to specify that those were integers??
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, jayda hendrickson! Python doesn't require that you first specify the data type of a variable. In fact, you can overwrite variables that were originally lists of strings with any data type of your choice, for example. I think what you're asking is how we know that it will be an int
.
Later on in this course, the code that calls that method will be using the random
module to produce a random integer and it is 100% guaranteed to produce an integer and nothing else So when we call it and pass in those random numbers, we can be certain they are integers.
Hope this helps!