Can we write the following code in one line, when a function switch the current player another one?
def switch_user(self,current):
if self.current == 'Player-1':
self.current = 'Player-2'
elif self.current == 'Player-2':
self.current = 'Player-1'
return
switchstatement - the use of the word "switch" is coincidental. It seems to be asking how to concisely toggle between two values.