def x1():
y = input("Input pet here: ")
if y == "pet":
return True
else:
return False
x1()
def x2():
y = input("Input pet here: ")
if y == "pet":
print(y)
else:
print("not a pet")
x2()
Input pet here: foo Input pet here: foo
Output: not a pet
Process finished with exit code 0
I have tried with many easy functions that simply should return something
I have no idea why is that.
return
does not print to output, it just returns function result. You may have seen this printing when using python shell
as it does print result for some needed reasons.
For your 1st function to print you must print the called function like this
print(x1())