I'm creating a choose your own adventure as a way to learn to code, and I've discovered that it's much easier to create a function for something than to type it over and over again. I created 2 new print functions to automatically add a pause and a space after some dialogue to break up the block of text, and that worked perfectly.
Now I'm noticing that I keep typing "variable" = input().strip().lower() on all the choices, and I was trying to streamline that into a function.
I tried:
def Input1():
input().lower().strip()
With the goal being to put "variable" = Input1()
But that failed
So I tried:
def Input1(Variable):
Variable = input().lower().strip()
and that failed
I feel like I'm missing something, I just can't figure out what.
source https://stackoverflow.com/questions/73465098/trying-to-make-a-function-that-automatically-adds-strip-lower-to-input
Comments
Post a Comment