Sep-06-2019, 05:06 AM
You are assigning "check" the outcome of your function str_analysis()
and the default value of return is None.
So "print(check)" prints "None".
Better pythonic way:
Don´t use print() inside a function that is doing something.
Always return the value of the outcome of this "doing".
and the default value of return is None.
So "print(check)" prints "None".
Better pythonic way:
Don´t use print() inside a function that is doing something.
Always return the value of the outcome of this "doing".
def str_analysis(your_input): if your_input.isdigit(): if int(your_input) > 99: return "Big number" elif int(your_input) <= 99: return "Small number" else: pass elif your_input.isalpha(): return "Your message is all Alpha characters" else: return "Your message is neither all Alpha nor all Digits"