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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Zahkyi Ferguson](https://secure.gravatar.com/avatar/1edd3c9bbc06b2bfd9782b137ba977c4?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Zahkyi Ferguson
504 PointsWhat is the purpose of the "int" function?
I thought the "int" function allowed the user to print numbers in a string, but Im able to print numbers without using "int".
2 Answers
![tomaszfurmanczyk](https://secure.gravatar.com/avatar/bfdd31a2ba561140de80bd5d1f225e5f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
tomaszfurmanczyk
Full Stack JavaScript Techdegree Student 18,242 PointsThe purpose of the int() function is so that you may use integers like this for instance from a users input:
Ask user the amount of gross money earned per month
monthly_pay = int(input("How much do you make per month? "))
Simple formula calculating the yearly pay by multiplying by 12 months to get the total yearly income
annual_pay = monthly_pay * 12
Displaying the total annual pay for the user to the console
print(f'Your annual pay is ${annual_pay:,.2f}')
Save this code in your workspace and name it whatever you would like for instance money_Display.py then run the program like this in the workspace console python money_Display
treehouse:~/workspace$ python money_Display.py
How much do you make per month? 4503
Your annual pay is $54,036.00
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThe "print" function actually works best on strings, but is smart enough to handle numbers.
You'd be more likely to need "int" if you were doing math on numbers in a string.
For more details, see the online manual page on int().