# Library
# Abstractions-- list of books, lendbook, addbook, removebook
# Student
# - order book
# - return book
### Keybase proof | |
I hereby claim: | |
* I am mysticbliss on github. | |
* I am saqie (https://keybase.io/saqie) on keybase. | |
* I have a public key ASDQHOYpCBJsOvBkw6SYayonsx2ejyCJKml1BCeCPKV5Pwo | |
To claim this, I am signing this object: |
ambari-server stop | |
ambari-agent stop | |
pkill -9 java | |
################################# | |
# Remove Packages | |
################################ | |
yum -y remove ambari-\* | |
yum -y remove hcatalog\* | |
yum -y remove hive\* |
Yield result one by one!
Generators are used to create iterators, but with a different approach. Generators are simple functions which return an iterable set of items, one at a time, in a special way.
When an iteration over a set of item starts using the for statement, the generator is run. Once the generator's function code reaches a "yield" statement, the generator yields its execution back to the for loop, returning a new value from the set. The generator function can generate as many values (possibly infinite) as it wants, yielding each one in its turn.
def fib():
Python allows you to open files in one of the three modes.
They are:
read-only mode, write-only mode, read-write mode, and append mode by specifying the flags r
, w
, rw
, a
respectively.
A text file can be opened in any one of the above said modes by specifying the option t
along with
r
, w
, rw
, and a
, so that the preceding modes become rt
, wt
, rwt
, and at
.
A binary file can be opened in any one of the above said modes by specifying the option b
along with r
, w
, rw
, and a
so that the preceding modes become rb
, wb
, rwb
, ab
.
A quick guide on getting ready for tech interviews.
Before diving into code, most interviewers like to chitchat about your background. They're looking for:
- Metacognition about coding. Do you think about how to code well?
- Ownership/leadership. Do you see your work through to completion? Do you fix things that aren't quite right, even if you don't have to?
- Communication. Nerd out about stuff. Show you're proud of what you've done, you're amped about what they're doing, and you have opinions about languages and workflows.
- STAR (Situation, Task, Action, Result). It’s good to have a project in your back pocket that you can talk about in a direct and concise way.
http://programmers.stackexchange.com/questions/21917/python-interview-questions | |
https://github.com/sigmavirus24/python-interview-questions | |
https://gist.github.com/xiangzhuyuan/7454001522d275021b2d | |
https://github.com/ContinuumIO/interview-questions | |
https://github.com/Flowerowl/python_articles | |
http://marselester.com/preparation-to-python-interview.html | |
https://github.com/zachwill/cracking-the-coding-interview | |
http://www.bogotobogo.com/python/python_interview_questions.php | |
https://www.quora.com/What-are-good-Python-interview-questions | |
https://www.reddit.com/r/Python/comments/1knw7z/python_interview_questions |
# Given a two dictionaries empdesig and empdet containing details about employees and managers in a key value pair - print a hierarchical tree | |
# empdesig = {'Simha': 'Khan', 'Khan': '', 'Vijay': 'Simha', 'Sai': 'Khan', 'Kiran': 'Kiran'} | |
# empdet = {'Simha': 'Khan', 'Khan': '', 'Vijay': 'Simha', 'Sai': 'Khan', 'Kiran': 'Kiran'} | |
# If an employee has manager null(like Khan) or has manager as himself - then they are board members and have no bosses. | |
for emp,mgr in empdesig.items(): | |
new[emp] = {key:'' for key,value in empdesig.items() if value == emp} | |
for k,v in new.items(): |