Welcome to the Treehouse Community
Looking to learn something new?
Mikkel Bielefeldt3,227 Points
Why doesn't the code just show?
So I've been watching some videos, and then to you know remember everything I learn, I try to build my own stuff. What I'm doing is trying to make a program that's asking for delivering information and more, and then for not making so much code I made a function in another document, and then tried to import it, and that is successful but then when I run the code it just says "function valid_names at 0x109584158" instead of actual printing the code wanted.
Here is the program where the function is in.
def valid_names(name): their_name = input("What is your name? ") if len(name) < 1: print("Minimum characters is 1.") elif name == float or int: print("Unvalid character.")
And here is the actual program.
from actualfunction import valid_names # This program will take your adress, phone number and more, so it'll know where to deliver the package # Then it'll say when it's expected to get delivered, and of course when it has been delivered. def printing_names(valid_names): print(valid_names) printing_names(valid_names)
I know some other ways to make this work, but I'm trying to put a lot of code into a small space, instead of writing lines of lines of code.
Dave StSomeWhere19,822 Points
Valid names is a function and you are just printing the function object.
If you want to pass the execution of the function to another function then you need to include the parenthesis. Then you can debug the additional issues and learn from there (e.g. actualfunction inputs into their_name but never uses that variable and you are comparing an input string to the classes float and int when you probably want to compare the type).
# just used bill for the argument since your function requires it printing_names(valid_names('bill'))