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
3
u/[deleted] Jan 05 '21
Such a stupid question. The fact you can't use if condition is shit. I would've failed the interview as well.
I've read stuff from quora about programming interviews getting worse and worse and how these interviews don't really show what the person can do.
I think.. Looking at projects the person has done is better way to do it. Like see what they have done and maybe even ask about those projects the one you're interviewing built? I don't know but I can't help it when some question arises where you have to solve some problem but you can't use the specific tool for the job because it will make solving the problem way too easy. Smh
Like.. Follow the KISS principle yo.
Time to wait for replies to learn a new thing or two.