Im trying to make a code where if the user input y the function will be ran again whereas if they enter n they will exit the function. I was able to make it work, but if I try entering the y or n in an uppercase letter, it will cause an error.
Can anyone tell me how to make it so that if the user enter either lower or upper case it wont matter? Thanks!!
Here's my code:
y = ("y") Y = ("Y") n = ("n") N = ("N") addanother = eval(input("Do you want to enter another student details? Please enter Y for yes and N for no\n")) if addanother == y or addanother == Y: enterAllMarksOfAStudentToStorage(allStudentMarks) if addanother == n or addanother == N: return
This code works if the user enter either lower or upper case, but I don't think having multiple variables for such a simple problem is a good code. Please help me fix this code