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 trialAcatrinei Leonard Cezar
2,239 PointsHow can I create a function when I have diferent types of numbers to add on my script ?
I mean...first number is 5 ok..and then I got 8 but how can create a function if I got two different numbers in one single function ?
2 Answers
KRIS NIKOLAISEN
54,971 PointsI'm not sure I follow you but using the quiz question:
def square(first_number):
first_result = first_number * first_number
return "The number {} squared is {}".format(first_number, first_result)
print(square(5))
print(square(8))
the result is:
The number 5 squared is 25
The number 8 squared is 64
Acatrinei Leonard Cezar
2,239 PointsThank you Kris...that really helped me ✌🏻