Description
The user input should be stripped of leading and trailing whitespace before converting it to lowercase.
Currently:
user_input = input("Type Rock/Paper/Scissors or Q to quit: ").lower()
I suggest changing it to:
user_input = input("Type Rock/Paper/Scissors or Q to quit: ").strip().lower()
This would make the input handling more robust. For example, if the user enters rock with extra spaces, .strip() will remove them and the input will correctly become rock.
This prevents valid user input from being rejected just because of accidental leading or trailing spaces.
Description
The user input should be stripped of leading and trailing whitespace before converting it to lowercase.
Currently:
I suggest changing it to:
This would make the input handling more robust. For example, if the user enters
rockwith extra spaces,.strip()will remove them and the input will correctly becomerock.This prevents valid user input from being rejected just because of accidental leading or trailing spaces.