When I'm doing this:
def pencil():
   print("pencil")
print("A", pencil())
Output showing:
pencil
A None
I tried some things but nothing worked.
When I'm doing this:
def pencil():
   print("pencil")
print("A", pencil())
Output showing:
pencil
A None
I tried some things but nothing worked.
def pencil():
    return "pencil"
print("A", pencil()) # A pencil
Or
def pencil():
    print("pencil")
print("A") # A
pencil()   # pencil
 
    
    When you do
print("A", pencil())
you are basically asking python to print "A" and the return value of the function named pencil.
Because you do not specify a return statement in your function definition, python returns None, hence the unwanted result.
As stated by other people, you just need to return "pencil" from the function so that the desired outcome can be achieved
 
    
    The default return value of a function is None
Your function doesn't have a return statement, so it will return None
Furthermore, print returns None to as it prints its input to the sys.stdout stream. So returning print("pencil") would also give you None
In order for you to get a value from a function you need to use the return statement and return a value. In your case "pencil":
def pencil():
    return "pencil"
print("A", pencil())
