I am new at Python and need a little help.
I am trying to use the next command in order to get user input from screen:
All is fine when I want to print something but when I am trying to combine an if else statement it seems that the user input is ignoring the case sensitive string that I wrote in the if == and it always return the else even when I writing the input 'Sam'
I want to make a simple task like this one:
print("What is your name ?")
name = sys.stdin.readline()
if name == 'Sam' :
print ('You are in our group')
print('You are not in our group')
The line will include the end of line character
'\n' (docs). So it's never equal to
'Sam' (except possibly at the end of the file).
name = name.strip() to remove it and any extra whitespace characters.