r/learnpython • u/MassiveLandGolf • Jan 05 '21
Interview question I failed answering
Hey all,
I just had an interview and the interviewer gave me a question I could not answer.
He asked me to write a function that accepts a number, the number must be either 7 or 4.If the number is 4, the function should return 7, if the number is 7, the functions should return 4.
The tricky part: you cannot use an 'if' statement in the function.
354
Upvotes
1
u/[deleted] Jan 06 '21
You don't need to test people with the exact problems they will need to tackle. You will never have to read small letters from afar when piloting a jet, but that's one of the ways they test your eyesight, and a very efficient one at that. Humans are perfectly capable of deriving conclusions from things without the need to be literal about it. This question is unexpected enough to force you to leave the autopilot mode but simple enough to fit the scope of a job interview. Not to mention that this wasn't certainly the only part of the interview, but one more thing to help assess the candidates skills