# [Function] Can i use Upper,lower string for parameter?

the user should type ‘odd’ or ‘even’, but if they use ‘Odd’ then code no longer true, how to use. (the answer didn’t talk about this) , i also tested many ways but not work.

``````#4. cho han
def cho_han(guess,bet):
#Makes sure your bet was above 0
if bet <= 0:
print("------------------")
print("Your bet should be above 0.")
return 0
print("------------------")
print('let guess, you guess',guess)
result1=random.randint(1,6)
result2=random.randint(1,6)
#print result:
if (result1+result2)%2==0:
print('result is even')
else:
print('result is odd')

#win lose
if ((result1+result2)%2==0 and guess=='even')or ((result1+result2)%2==1 and guess=='odd'):
print('you won', bet,'dollars')
#elif (result1+result2)%2==1 and guess=='odd':
#print('you won', bet,'dollars')
return bet
else:
print('you lost', bet, 'dollars')

cho_han('Odd',40)
``````

what happens if you convert it

i use many syntax searched on the internet, str.lower , string.slower(guess) as parameter… error. could you tell me ?

If you convert what they typed to all lower case, then it’ll always be all lower case
Better if you think about what you would need to do instead of testing random things. Pick one, and then think about how you can do that specific thing.

ya, i mean how to do that

i had search and try, so many way and not work. does anybody know?

this guide not about apply to function

You wouldn’t do it any differently just because it’s in a function

A parameter is a variable same as any other, the only difference being that they get assigned when the function is invoked, after that they’re the same.

If you were trying to put code inside the parameter list then yeah you’d have a problem, there’s nothing saying you can do that.
But you can put code in the body of the function, and you’re free to do whatever you want with the values that were given to your function.

i just want a specific answer, if it work then it work.