Python Forum
Drop Dead Simple Interview Questions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drop Dead Simple Interview Questions
#21
The best job I ever had, i sat down in a room of six people and was grilled by extremely knowledgeable people
I was called back and grilled by two of their superiors.
When it was all over and I got the job, I thanked them for letting me know in advance who I would be working
for and with.
That job was at Instrumentation Laboratories.
I worked initially on new product development., and specifically
on a new concept scanning plasma monochrometer.
After the first year, I was called in for my first review, asked how I thought I did
(and was expected to give a through, and truthful answer).
I was thanked and given a healthy raise.

Pure bliss.

Unfortunately, several years later we were purchased by Allied Chemical who quickly (within a year)
sold off any division taking in less that 30 million. Of which, we were one.
Reply
#22
(Feb-13-2017, 08:41 PM)nilamo Wrote: I feel like writing code, right in front of someone, it a good idea. Even if it's not a real language, and just pseudocode. Gluing together snippets from google can only get you so far.

If they're gluing together snippets from Google it's pretty obvious in the code sample they provide. I find you can ask questions in English to get deeper. Describe how you've used such and such technique in a program. How would you approach this or that problem?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#23
(Feb-13-2017, 05:56 PM)nilamo Wrote: If you actually want the job, then this would be better (or having four print statements, and using "end=''" a lot):
>>> for n in range(1, 16):
...     ans = ""
...     if 0 == n%3:
...         ans += "Fizz"
...     if 0 == n%5:
...         ans += "Buzz"
...     if not ans:
...         ans = n
...     print(ans)
.............
Actually, IMHO this is not the best answer:
  • You don't need incremental assignment under the first if
  • The last if would better be elif
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#24
(Apr-17-2017, 07:50 PM)volcano63 Wrote:
  • The last if would better be elif

I disagree. That would give extra semantic meaning to the "divisible by 5" check that doesn't exist for the "divisible by 3" check. And extra semantic meaning serves no purpose other than to confuse whoever looks at the code in the future.

If you were to look at the code, without knowing the problem ahead of time, you'd see two options:
a) divisible by 3 and
b) divisible by 5

...except that there's an extra clause tacked on to option b that sort of reads "if it's not divisible by 5, and also if nothing else happened so far, then just use the number". Which makes you stop and wonder why option b is special compared to option a. It wouldn't be immediately obvious that it isn't obvious, it just happens to come last in the loop.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pipenv & Requests Author Kenneth Reitz Interview Evrone 1 2,043 Jan-28-2021, 02:16 PM
Last Post: elizabethlvova
Star Flask Creator Armin Ronacher Interview elizabethlvova 1 1,884 Dec-16-2020, 09:10 AM
Last Post: Evrone
  Becoming a Self-Taught Programmer: Cory Althoff Interview Evrone 0 1,860 Dec-16-2020, 08:49 AM
Last Post: Evrone
  PEP 594 -- Removing dead batteries from the standard library ichabod801 3 2,720 May-31-2019, 01:23 PM
Last Post: heiner55
  Best resource to learn and pass interview oryucouk 5 2,981 May-18-2019, 05:19 AM
Last Post: heiner55
  MIT Interview with Guido Larz60+ 3 3,284 Nov-27-2018, 10:45 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020