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

Python Comparison Solution

Why do I get this message, <function fuzzball_game> at 0x7f59... ?

I have created a main function that houses my if, elif, and else statements, and created an input for the name and number.

Here is my code below: ```name = input("Please enter your name: ") number = input("Please enter a number: ")

 #number_int = int()
 number = int(number)
 #fuzz and buzz will be input to test if certain divisible numbers, and fuzz and buzz together will just combine them

  """fuzz = input("{}".format)
  buzz = input("{}".format)"""
  fizz = input("is fizz")
  buzz = input("is buzz")
  # TODO: Print out the User's name and the number entered,
  # making sure the two statements are on separate lines of output.
  """int(name)
       print(number)"""
   print ("Hey {}!\nThe number {}...".format(name, number))
  # TODO: Compare the number the user gave with the different
  # FizzBuzz conditions. 
  # *********************
  # If the number is divisible by 3, print "is a Fizz number."
  # If the number is divisible by 5, print "is a Buzz number."
  # If the number is divisible by both 3 and 5, print "is a FizzBuzz number."
  # Otherwise, print "is neither a fizzy or a buzzy number."
  # *********************



   def fuzzbuzz_game(number):
         if number % 3==0:
         print(fizz)

   elif number % 5==0:
         print(buzz)


   elif (number % 3)+(number % 3)==0:
        print(buzz*fuzz)

   else:
        print("It is neither a fizzy or a buzzy number.")



   print(fuzzbuzz_game)

   # TODO: Define variables for is_fizz and is_buzz that stores 
   # a Boolean value of the condition. Remember that the modulo operator, %, 
   # can be used to check if there is a remainder.

   # Using the variables, check the condition of the value, and print the necessary
   # string

2 Answers

Hambone F
Hambone F
3,581 Points

Hi Luke,

You're getting that result because you are printing the function rather than invoking it. Basically you are telling python to print the function's definition, rather than it's output.

You may need to revisit the formatting/indentation of your code as well.

Since the function already prints the results and doesn't return anything, I think you simply want to call it:

# replace this
print(fuzzbuzz_game)

# with this
fuzzbuzz_game(number)

However, if instead of printing the results directly, your function returned a value, you would want this instead:

print(fuzzbuzz_game(number))

It looks looks complicated :D Try to write it always as short and easy ( to read) as possible :D