Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
You are given a 7 digit phone number, and you should find all possible letter combinations based on the digit-to-letter mapping on numeric pad and return only the ones that have valid match against a given dictionary of words.
Give all possible letter combinations from a phone number.
Generate all subsets of a string.
Print all possible N
pairs of balanced parentheses.
E.g. when N
is 2
, the function should print (())
and ()()
.
E.g. when N
is 3
, we should get ((()))
, (()())
, (())()
, ()(())
, ()()()
.
Given a list of arrays, return a list of arrays, where each array is a combination of one element in each given array.
E.g. If the input is [[1, 2, 3], [4], [5, 6]]
, the output should be [[1, 4, 5], [1, 4, 6], [2, 4, 5], [2, 4, 6], [3, 4, 5], [3, 4, 6]]
.
Before anything else, you need to pick a programming language to do your interviews in. Most companies will let you code in any language you want, the only exception I know being Google, where they only allow candidates to pick from Java, C++ or Python for their algorithmic coding interviews. Most of the time, I would recommend that you use a language that you are extremely familiar with rather than picking up a new language just for doing interviews because the company uses that language heavily.
There are some languages which are more suitable than others for coding interviews and some languages you absolutely want to avoid. From my experience interviewing as an interviewer, most candidates pick Python or Java. Other commonly seen languages include JavaScript, Ruby and C++. I would absolutely avoid lower level languages like C or Go, simply because they lack in many standard library functions and data structures.
Personally, Python is my de facto choice for coding algorithms during interviews because it is succinct and has a pretty huge library of functions and data structures available. One of my top reasons for recommending Python is that it uses consistent APIs that operate on different data structures, such as len()
, for ... in ...
and slicing notation on sequences (strings/lists/tuples). Getting the last element in a sequence is arr[-1]
and reversing it is simply arr[::-1]
. You can achieve a lot with minimal syntax in Python.
Java is a decent choice too but having to constantly declare types in your code means extra keystrokes which results in slower coding/typing speed. This issue will be more apparent when you have to write on a whiteboard during on-site interviews. The reasons for choosing/not choosing C++ are similar to Java. Ultimately, Python, Java and C++ are decent choices of languages. If you have been using Java at work for a while now and do not have time to be comfortably familiar with another language, I would recommend just sticking to Java instead of picking up Python from scratch just for interviews to avoid having to context switch between languages during work vs interviews. Most of the time, the bottleneck is in the thinking and not the writing.
One exception to the convention of allowing you to "pick any programming language you want" is when you are interviewing for a domain-specific position, such as Front End/iOS/Android Engineer roles, in which you would need to be familiar with coding algorithms in JavaScript, Objective-C/Swift and Java respectively. If you need to use a data structure that the language does not support, such as a Queue or Heap in JavaScript, perhaps try asking the interviewer whether you can assume that you have a data structure that implements certain methods with specified time complexities. If the implementation of that data structure is not crucial to solving the problem, the interviewer will usually allow it. In reality, being aware of existing data structures and selecting the appropriate ones to tackle the problem at hand is more important than knowing the intricate implementation details.
If you have been out of college for a while, it is highly advisable to review CS fundamentals — Algorithms and Data Structures. Personally, I prefer to review as I practice, so I scan through my college notes and review the various algorithms as I work on algorithm problems from LeetCode and Cracking the Coding Interview.
This interviews repository by Kevin Naughton Jr. served as a quick refresher for me.
The Medium publication basecs by Vaidehi Joshi is also a great and light-hearted resource to recap on the various data structures and algorithms.
If you are interested in how data structures are implemented, check out Lago, a Data Structures and Algorithms library for JavaScript. It is pretty much still WIP but I intend to make it into a library that is able to be used in production and also a reference resource for revising Data Structures and Algorithms.
Next, gain familiarity and mastery of the algorithms and data structures in your chosen programming language:
Practice coding algorithms using your chosen language. While Cracking the Coding Interview is a good resource for practice, I prefer being able to type code, run it and get instant feedback. There are various Online Judges such as LeetCode, HackerRank and CodeForces for you to practice questions online and get used to the language. From experience, LeetCode questions are the most similar to the kind of questions being asked in interviews whereas HackerRank and CodeForces questions are more similar to competitive programming questions. If you practice enough LeetCode questions, there is a good chance that you would have seen/done your actual interview question (or some variant) on LeetCode before. If you are more of a visual person, Coderust explains the common algorithm questions through step-by-step visualizations which makes understanding the solutions much easier.
Learn and understand the time and space complexities of the common operations in your chosen language. For Python, this page will come in handy. Also find out the underlying sorting algorithm that is being used in the language's sort()
function and its time and space complexity (in Python its Timsort which is a hybrid sort). After completing a question on LeetCode, I usually add the time and space complexities of the written code as comments above the function body to remind myself to analyze the algorithm after I am done with the implementation.
Read up on the recommended coding style for your language and stick to it. If you have chosen Python, refer to the PEP 8 Style Guide. If you have chosen Java, refer to Google's Java Style Guide.
Find out and be familiar with the common pitfalls and caveats of the language. If you point out them out during the interview and intelligently avoid falling into them, you will usually impress the interviewer and that results in bonus points in your feedback, regardless of whether the interviewer is familiar with the language or not.
Gain a broad exposure to questions from various topics. In the second half of the article I mention algorithm topics and practice questions for each topic. Do around 100–200 LeetCode questions and you should be good.
Practice, practice and more practice!
Congratulations, you are ready to put your skills into practice! In a real coding interview, you will be given a technical question by the interviewer, write code in a real-time collaborative editor (phone screen) or on a whiteboard (on-site) to solve the problem within 30–45 minutes. This is where the real fun begins!
Your interviewer will be looking out for signals that you fit the requirements of the role and it is up to you to display those signals to them. Initially it may feel weird to be talking while you are coding as most programmers do not have the habit of explaining out loud as they are typing code. However, it is hard for the interviewer to know what you are thinking just by looking at the code that you type. If you communicate your approach to the interviewer before you start coding, you can validate your approach with them and the both of you can agree upon an acceptable approach.
Before the Interview (Remote)
For phone screens/remote interviews, prepare paper and pen/pencil to jot down and visualize stuff. If you are given a question on trees and graphs, it usually helps if you draw out some examples of the data structure given in the question.
Use earphones and make sure you are in a quiet environment. You definitely do not want to be holding a phone in one hand and only be able to type with the other. Try avoiding using speakers because if the echo is bad, communication is harder and repeating of words will just result in loss of valuable time.
Self Introduction
TODO
Upon Getting the Question
Many candidates jump into coding the moment they hear the question. That is usually a big mistake. Take a moment to repeat the question back at the interviewer and make sure that you understand exactly what they are asking. If you misunderstood and when you repeat back the question, they will clarify.
Always seek clarification about the question upon hearing it even if it you think it is clear to you. You might discover something that you have missed out and it also sends a signal to the interviewer that you are a careful person who pays attention to details. Some interviewers deliberately omit important details to see if you ask the right questions. Consider asking the following questions:
How big is the size of the input?
How big is the range of values?
What kind of values are there? Are there negative numbers? Floating points? Will there be empty inputs?
Are there duplicates within the input?
What are some extreme cases of the input?
How is the input stored? If you are given a dictionary of words, is it a list of strings or a Trie?
After you have sufficiently clarified the scope and intention of the problem, explain your high level approach to the interviewer even if it is a naive solution. If you are stuck, consider various approaches and explain out loud why it will/will not work. Sometimes your interviewer might drop hints and lead you towards the right path.
Start with a brute force approach, communicate it to the interviewer, explain the time and space complexity and why it is bad. It is unlikely that the brute force approach will be one that you will be coding. At this point, the interviewer will usually pop the dreaded "Can we do better?" question, meaning that they are looking for a more optimal approach. In my opinion, this is usually the hardest part of the interview. In general, look for repeated work and try to optimize them by potentially caching the calculated result somewhere and reference it later, rather than having to compute it all over again. There are some tips on tackling topic-specific questions that I dive into details below.
Only start coding after you and your interviewer have agreed on an approach and has given you the green light.
Starting to Code
Write your code with good coding style. Reading code written by others is usually not an enjoyable task. Reading horribly-formatted code by others makes it worse. Your goal is to make your interviewer understand the code you have written so that they can quickly evaluate if your code does what you say it does and whether it solves the given problem. Use clear variable names, avoid single letter names unless they are for iteration. However, if you are coding on a whiteboard, you might not want to use extremely verbose variable names for the sake of reducing the amount you have to write.
Always be explaining what you are currently writing/typing to the interviewer. This is not about literally reading out what you are typing to the interviewer. Talk about the section of the code you are currently implementing at a higher level, explain why it is written as such and what it is trying to achieve.
When you copy and paste code, consider whether it is necessary. Sometimes it is, sometimes it is not. If you find yourself copying and pasting one large chunk of code spanning multiple lines, it is probably an indicator that you can refactor by containing those lines into a function. If it is just a single line you copied, usually it is fine. Do remember to change the respective variables in your copied line of code where relevant. Copy-paste errors are a common source of bugs even in day-to-day coding!
After Coding
After you have finished coding, do not immediately announce to the interviewer that you are done. In most cases, your code is usually not perfect and contains some bugs or syntax errors. What you need to do now is to review your code.
Firstly, look through your code from start to finish as if it is the first time you are seeing it, as if it was written by someone else and you are trying to spot bugs in it. That's exactly what your interviewer will be doing. Look through and fix any minor issues you may find.
Next, come up with small test cases and step through the code (not your algorithm!) with those sample input. Interviewers like it when you read their mind and what they usually do after you have finished coding would be to get you to write tests. It is a huge plus if you write tests for your code even before prompts from them. You should be emulating a debugger when stepping through and jot down or say out the values of certain variables as you step through the lines of code.
If there are huge duplicated chunks of code in your solution, it would be a good chance to refactor it and demonstrate to the interviewer that you are one who values code quality. Also look out for places where you can do short-circuit evaluation.
Lastly, give the time/space complexity of your code and explain why it is such. You can even annotate certain chunks of your code with the various time/space complexities to demonstrate your understanding of your code and the APIs of your chosen programming language. Explain any trade-offs in your current approach vs alternative approaches, possibly in terms of time/space.
If your interviewer is happy with the solution, the interview usually ends here. It is also not uncommon that the interviewer asks you extension questions, such as how you would handle the problem if the whole input is too large to fit into memory, or if the input arrives as a stream. This is a common follow-up question at Google where they care a lot about scale. The answer is usually a divide-and-conquer approach — perform distributed processing of the data and only read certain chunks of the input from disk into memory, write the output back to disk and combine them later on.
Interviewing is a skill that you can get better at. The steps mentioned above can be rehearsed over and over again until you have fully internalized them and following those steps become second nature to you. A good way to practice is to find a friend to partner with and the both of you can take turns to interview each other.
A great resource for practicing mock coding interviews would be interviewing.io. interviewing.io provides free, anonymous practice technical interviews with Google and Facebook engineers, which can lead to real jobs and internships. By virtue of being anonymous during the interview, the inclusive interview process is de-biased and low risk. At the end of the interview, both interviewer and interviewees can provide feedback to each other for the purpose of improvement. Doing well in your mock interviews will unlock the jobs page and allow candidates to book interviews (also anonymously) with top companies like Uber, Lyft, Quora, Asana and more. For those who are totally new to technical interviews, you can even view a demo interview on the site (requires sign in). Read more about them here.
I have used interviewing.io both as an interviewer and an interviewee and found the experience to be really great! Aline Lerner, the CEO and co-founder of interviewing.io and her team are passionate about revolutionizing the technical interview process and helping candidates to improve their skills at interviewing. She has also published a number of technical interview-related articles on the interviewing.io blog. interviewing.io is still in beta now but I recommend signing up as early as possible to increase the likelihood of getting an invite.
Another platform that allows you to practice coding interviews is Pramp. Where interviewing.io matches potential job seekers with seasoned technical interviewers, Pramp takes a different approach. Pramp pairs you up with another peer who is also a job seeker and both of you take turns to assume the role of interviewer and interviewee. Pramp also prepares questions for you, along with suggested solutions and prompts to guide the interviewee.
Personally, I am not that fond of Pramp's approach because if I were to interview someone, I would rather choose a question I am familiar with. Also, many users of the platform do not have the experience of being interviewers and that can result in a horrible interview experience. There was once where my matched peer, as the interviewer, did not have the right understanding of the question and attempted to lead me down the wrong path of solving the question. However, this is more of a problem of the candidate than the platform though.
Coding interviews are tough. But fortunately, you can get better at them by studying and practicing for them, and doing mock interviews. To recap, to do well in coding interviews:
Decide on a programming language
Study CS fundamentals
Practice solving algorithm questions
Internalize the Do's and Don'ts of interviews
Practice doing mock interviews
Interview successfully to get the job
By following these steps, you will improve your coding interview skills, and be one step closer (or probably more) to landing your dream job.
All the best!
How to Write an Effective Resume of Python Developer
With the world’s orientation towards digital technology, The Python programming language has raised its value. It has overshadowed many occupations and Python developers have numerous opportunities for career growth.
With knowledge of Python programming language, you can work in innovative fields such as artificial intelligence, machine learning, and data science. However, to get there you first need to gain the attention of employers. That's when the resume steps in.
A resume presents the first impression that hiring managers make of you. How you write your resume will determine whether you'll have a chance to win them over at the interview or you'll end up in the "don't contact" pile. If you are ready to get some job interviews scheduled, here are the tips you should follow when writing your resume.
While job descriptions usually all sound pretty much the same, you should customize your resume. There is always a way to make your resume more suitable for individual job positions. Instead of typical generalization, adapt your resume before you click the send button.
Start with creating a template with all the basic information that all employers require. Later, you can frame the resume based on specifications that different companies seek for. For example, if an employer requires at least two years of experience, your resume must contain specific job experiences that show that you have fulfilled that condition. Otherwise, don’t waste time on that application. One of the biggest mistakes that many job applicants make is including their job experience that has nothing to do with the occupation they pursue. The fact that you worked at McDonald's when you were sixteen won't influence the employer to give you the job of a Python developer.
The dilemma that worries many resume-makers is how to form the resume. When choosing a layout for a Python developer resume you will encounter three options:
Chronological layout – Lists your experiences in chronological order
Reverse chronological layout – Puts the focus on the relevant experiences like a timeline (starting from the last job position)
Functional layout – Emphasizes your skills
The most common form is the chronological layout. However, what makes reverse chronological layout increasingly popular is that it highlights your most recent experience. This works best if your last job position was a Python developer as that would instantly show the employer that you have experience.
The functional layout can be tricky as it demands creativity. The situation in which this format is a good choice is when you don’t have real work experience but you do have strong skills that depict you as a promising developer.
The length of the resume has always been a troublesome topic. People usually aim to make the resume longer so that it seems like they have more experience. That’s not such a good idea.
A national survey conducted by Harris Poll for CareerBuilder showed that concise resumes have more than an 80% chance of being accepted. A two-page resume is claimed to have the perfect length.
Presenting yourself in a concise form will keep the reader's attention until the end of the resume. Keep in mind that hiring managers go through at least dozens of resumes and they won't have the concentration or desire to read essay-like CVs.
If you can’t manage to present the information concisely, you can always turn to writing and editing professionals. For example, experts that work for BestEssayEducation can rephrase some points for a cleaner look. Or, you can use editing tools like HemingwayEditor.
Did you know that clichéd and generic terms that hiring managers have seen in almost all resumes increase your chance of not getting the job by 50%? Companies that look for Python developers who are experts in their job and great team players won't be drawn to dull and typical resumes.
Luckily, New College of the Humanities has researched top cliché terms that you shouldn't use in your resume. They surveyed 2,000 employers and the terms that came up as repelling are the following:
Works well under pressure
Excellent written communication skills
Can work independently
Problem solver
Hard worker
Good communicator
Proactive
Enthusiastic
Team player
Good listener
A generic resume will hurt your possibility to stand out and attract the attention of potential employers.
According to research, resumes that have typos or bad grammar have the highest chance of getting instantly rejected (77%). Meaning, that your expertise can fall in the shadow of a poorly written resume.
Even though you are applying for a position of a Python developer, that doesn’t mean that you can be careless. If you want to ensure that no mistakes pass you by, you can use some of these services and tools:
TrustMyPaper – This writing service only works with most talented writers with great attention to detail. They can signal any mistakes or inconsistencies in your resume.
GrabMyEssay – With both writing and editing services at your disposal, you can find all that you need for polishing your essay on this website.
Studicus – The numerous positive testimonials speak for Studicus’ professionalism. Writers must have years of experience to work for this company so you’ll be teamed up with experts.
Grammarly – If you are looking for a quick fix, Grammarly is an online editing tool that will ensure that your resume doesn't have any grammar or spelling mistakes.
Readable – Readability checkers such as Readable will point out any confusing or ambiguous parts of your resume.
The first thing that hiring managers will notice about your resume is the design. Using a flashy and chaotic design doesn’t really say “this is the best Python developer for this company.” Simplicity is the safest and most elegant choice when it comes to design. Keep it simple and consistent with the style and you won’t have to worry about whether the design will send the wrong message.
Here are a few suggestions when it comes to resume design:
Underline headers and sections
Use fonts that are easy to read (Times New Roman, Arial, etc.)
The recommendable font size is 12 (or 11 if you want to fit information within 2 pages)
Use bullets for listing
Use bold text for emphasis (for job titles for example)
List qualifications and skills with bullets rather than stating them in a paragraph
The number of jobs for Python developers is continually growing. As companies switch to advanced technologies their need for Python programming language appears. This is the perfect time to find the job of your dreams. But first, consider the above-mentioned tips and create a winning resume.
Kristin Savage nourishes, sparks, and empowers using the magic of a word. Along with pursuing her degree in Creative Writing, Kristin was gaining experience in the publishing industry, with expertise in marketing strategy for publishers and authors. Besides working as a freelance writer at WowGrade she also does some editing work at SupremeDissertations. In her free time, Kristin likes to travel and explore new countries around the world.
1. Write a Python program to print the following string in a specific format (see the output). Go to the editor Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are" Output :
Click me to see the sample solution
2. Write a Python program to get the Python version you are using. Go to the editor Click me to see the sample solution
3. Write a Python program to display the current date and time. Sample Output : Current date and time : 2014-07-05 14:34:14 Click me to see the sample solution
4. Write a Python program which accepts the radius of a circle from the user and compute the area. Go to the editor Sample Output : r = 1.1 Area = 3.8013271108436504 Click me to see the sample solution
5. Write a Python program which accepts the user's first and last name and print them in reverse order with a space between them. Go to the editor Click me to see the sample solution
6. Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers. Go to the editor Sample data : 3, 5, 7, 23 Output : List : ['3', ' 5', ' 7', ' 23'] Tuple : ('3', ' 5', ' 7', ' 23') Click me to see the sample solution
7. Write a Python program to accept a filename from the user and print the extension of that. Go to the editor Sample filename : abc.java Output : java Click me to see the sample solution
8. Write a Python program to display the first and last colors from the following list. Go to the editor color_list = ["Red","Green","White" ,"Black"] Click me to see the sample solution
9. Write a Python program to display the examination schedule. (extract the date from exam_st_date). Go to the editor exam_st_date = (11, 12, 2014) Sample Output : The examination will start from : 11 / 12 / 2014 Click me to see the sample solution
10. Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. Go to the editor Sample value of n is 5 Expected Result : 615 Click me to see the sample solution
11. Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s). Sample function : abs() Expected Result : abs(number) -> number Return the absolute value of the argument. Click me to see the sample solution
12. Write a Python program to print the calendar of a given month and year. Note : Use 'calendar' module. Click me to see the sample solution
13. Write a Python program to print the following 'here document'. Go to the editor Sample string : a string that you "don't" have to escape This is a ....... multi-line heredoc string --------> example Click me to see the sample solution
14. Write a Python program to calculate number of days between two dates. Sample dates : (2014, 7, 2), (2014, 7, 11) Expected output : 9 days Click me to see the sample solution
15. Write a Python program to get the volume of a sphere with radius 6. Click me to see the sample solution
16. Write a Python program to get the difference between a given number and 17, if the number is greater than 17 return double the absolute difference. Go to the editor Click me to see the sample solution
17. Write a Python program to test whether a number is within 100 of 1000 or 2000. Go to the editor Click me to see the sample solution
18. Write a Python program to calculate the sum of three given numbers, if the values are equal then return three times of their sum. Go to the editor Click me to see the sample solution
19. Write a Python program to get a new string from a given string where "Is" has been added to the front. If the given string already begins with "Is" then return the string unchanged. Go to the editor Click me to see the sample solution
20. Write a Python program to get a string which is n (non-negative integer) copies of a given string. Go to the editor Click me to see the sample solution
21. Write a Python program to find whether a given number (accept from the user) is even or odd, print out an appropriate message to the user. Go to the editor Click me to see the sample solution
22. Write a Python program to count the number 4 in a given list. Go to the editor Click me to see the sample solution
23. Write a Python program to get the n (non-negative integer) copies of the first 2 characters of a given string. Return the n copies of the whole string if the length is less than 2. Go to the editor Click me to see the sample solution
24. Write a Python program to test whether a passed letter is a vowel or not. Go to the editor Click me to see the sample solution
25. Write a Python program to check whether a specified value is contained in a group of values. Go to the editor Test Data : 3 -> [1, 5, 8, 3] : True -1 -> [1, 5, 8, 3] : False
Click me to see the sample solution
26. Write a Python program to create a histogram from a given list of integers. Go to the editor Click me to see the sample solution
27. Write a Python program to concatenate all elements in a list into a string and return it. Go to the editor Click me to see the sample solution
28. Write a Python program to print all even numbers from a given numbers list in the same order and stop the printing if any numbers that come after 237 in the sequence. Go to the editor Sample numbers list :
Click me to see the sample solution
29. Write a Python program to print out a set containing all the colors from color_list_1 which are not present in color_list_2. Go to the editor Test Data : color_list_1 = set(["White", "Black", "Red"]) color_list_2 = set(["Red", "Green"]) Expected Output : {'Black', 'White'} Click me to see the sample solution
30. Write a Python program that will accept the base and height of a triangle and compute the area. Go to the editor Click me to see the sample solution
31. Write a Python program to compute the greatest common divisor (GCD) of two positive integers. Go to the editor Click me to see the sample solution
32. Write a Python program to get the least common multiple (LCM) of two positive integers. Go to the editor Click me to see the sample solution
33. Write a Python program to sum of three given integers. However, if two values are equal sum will be zero. Go to the editor Click me to see the sample solution
34. Write a Python program to sum of two given integers. However, if the sum is between 15 to 20 it will return 20. Go to the editor Click me to see the sample solution
35. Write a Python program that will return true if the two given integer values are equal or their sum or difference is 5. Go to the editor Click me to see the sample solution
36. Write a Python program to add two objects if both objects are an integer type. Go to the editor Click me to see the sample solution
37. Write a Python program to display your details like name, age, address in three different lines. Go to the editor Click me to see the sample solution
38. Write a Python program to solve (x + y) * (x + y). Go to the editor Test Data : x = 4, y = 3 Expected Output : (4 + 3) ^ 2) = 49 Click me to see the sample solution
39. Write a Python program to compute the future value of a specified principal amount, rate of interest, and a number of years. Go to the editor Test Data : amt = 10000, int = 3.5, years = 7 Expected Output : 12722.79 Click me to see the sample solution
40. Write a Python program to compute the distance between the points (x1, y1) and (x2, y2). Go to the editor Click me to see the sample solution
41. Write a Python program to check whether a file exists. Go to the editor Click me to see the sample solution
42. Write a Python program to determine if a Python shell is executing in 32bit or 64bit mode on OS. Go to the editor Click me to see the sample solution
43. Write a Python program to get OS name, platform and release information. Go to the editor Click me to see the sample solution
44. Write a Python program to locate Python site-packages. Go to the editor Click me to see the sample solution
45. Write a python program to call an external command in Python. Go to the editor Click me to see the sample solution
46. Write a python program to get the path and name of the file that is currently executing. Go to the editor Click me to see the sample solution
47. Write a Python program to find out the number of CPUs using. Go to the editor Click me to see the sample solution
48. Write a Python program to parse a string to Float or Integer. Go to the editor Click me to see the sample solution
49. Write a Python program to list all files in a directory in Python. Go to the editor Click me to see the sample solution
50. Write a Python program to print without newline or space. Go to the editor Click me to see the sample solution
51. Write a Python program to determine profiling of Python programs. Go to the editor Note: A profile is a set of statistics that describes how often and for how long various parts of the program executed. These statistics can be formatted into reports via the pstats module. Click me to see the sample solution
52. Write a Python program to print to stderr. Go to the editor Click me to see the sample solution
53. Write a python program to access environment variables. Go to the editor Click me to see the sample solution
54. Write a Python program to get the current username Go to the editor Click me to see the sample solution
55. Write a Python to find local IP addresses using Python's stdlib Go to the editor Click me to see the sample solution
56. Write a Python program to get height and width of the console window. Go to the editor Click me to see the sample solution
57. Write a Python program to get execution time for a Python method. Go to the editor Click me to see the sample solution
58. Write a Python program to sum of the first n positive integers. Go to the editor Click me to see the sample solution
59. Write a Python program to convert height (in feet and inches) to centimeters. Go to the editor Click me to see the sample solution
60. Write a Python program to calculate the hypotenuse of a right angled triangle. Go to the editor Click me to see the sample solution
61. Write a Python program to convert the distance (in feet) to inches, yards, and miles. Go to the editor Click me to see the sample solution
62. Write a Python program to convert all units of time into seconds. Go to the editor Click me to see the sample solution
63. Write a Python program to get an absolute file path. Go to the editor Click me to see the sample solution
64. Write a Python program to get file creation and modification date/times. Go to the editor Click me to see the sample solution
65. Write a Python program to convert seconds to day, hour, minutes and seconds. Go to the editor Click me to see the sample solution
66. Write a Python program to calculate body mass index. Go to the editor Click me to see the sample solution
67. Write a Python program to convert pressure in kilopascals to pounds per square inch, a millimeter of mercury (mmHg) and atmosphere pressure. Go to the editor Click me to see the sample solution
68. Write a Python program to calculate the sum of the digits in an integer. Go to the editor Click me to see the sample solution
69. Write a Python program to sort three integers without using conditional statements and loops. Go to the editor Click me to see the sample solution
70. Write a Python program to sort files by date. Go to the editor Click me to see the sample solution
71. Write a Python program to get a directory listing, sorted by creation date. Go to the editor Click me to see the sample solution
72. Write a Python program to get the details of math module. Go to the editor Click me to see the sample solution
73. Write a Python program to calculate midpoints of a line. Go to the editor Click me to see the sample solution
74. Write a Python program to hash a word. Go to the editor Click me to see the sample solution
75. Write a Python program to get the copyright information and write Copyright information in Python code. Go to the editor Click me to see the sample solution
76. Write a Python program to get the command-line arguments (name of the script, the number of arguments, arguments) passed to a script. Go to the editor Click me to see the sample solution
77. Write a Python program to test whether the system is a big-endian platform or little-endian platform. Go to the editor Click me to see the sample solution
78. Write a Python program to find the available built-in modules. Go to the editor Click me to see the sample solution
79. Write a Python program to get the size of an object in bytes. Go to the editor Click me to see the sample solution
80. Write a Python program to get the current value of the recursion limit. Go to the editor Click me to see the sample solution
81. Write a Python program to concatenate N strings. Go to the editor Click me to see the sample solution
82. Write a Python program to calculate the sum of all items of a container (tuple, list, set, dictionary). Go to the editor Click me to see the sample solution
83. Write a Python program to test whether all numbers of a list is greater than a certain number. Go to the editor Click me to see the sample solution
84. Write a Python program to count the number occurrence of a specific character in a string. Go to the editor Click me to see the sample solution
85. Write a Python program to check whether a file path is a file or a directory. Go to the editor Click me to see the sample solution
86. Write a Python program to get the ASCII value of a character. Go to the editor Click me to see the sample solution
87. Write a Python program to get the size of a file. Go to the editor Click me to see the sample solution
88. Given variables x=30 and y=20, write a Python program to print "30+20=50". Go to the editor Click me to see the sample solution
89. Write a Python program to perform an action if a condition is true. Go to the editor Given a variable name, if the value is 1, display the string "First day of a Month!" and do nothing if the value is not equal. Click me to see the sample solution
90. Write a Python program to create a copy of its own source code. Go to the editor Click me to see the sample solution
91. Write a Python program to swap two variables. Go to the editor Click me to see the sample solution
92. Write a Python program to define a string containing special characters in various forms. Go to the editor Click me to see the sample solution
93. Write a Python program to get the Identity, Type, and Value of an object. Go to the editor Click me to see the sample solution
94. Write a Python program to convert a byte string to a list of integers. Go to the editor Click me to see the sample solution
95. Write a Python program to check whether a string is numeric. Go to the editor Click me to see the sample solution
96. Write a Python program to print the current call stack. Go to the editor Click me to see the sample solution
97. Write a Python program to list the special variables used within the language. Go to the editor Click me to see the sample solution
98. Write a Python program to get the system time. Go to the editor
Note : The system time is important for debugging, network information, random number seeds, or something as simple as program performance. Click me to see the sample solution
99. Write a Python program to clear the screen or terminal. Go to the editor Click me to see the sample solution
100. Write a Python program to get the name of the host on which the routine is running. Go to the editor Click me to see the sample solution
101. Write a Python program to access and print a URL's content to the console. Go to the editor Click me to see the sample solution
102. Write a Python program to get system command output. Go to the editor Click me to see the sample solution
103. Write a Python program to extract the filename from a given path. Go to the editor Click me to see the sample solution
104. Write a Python program to get the effective group id, effective user id, real group id, a list of supplemental group ids associated with the current process. Go to the editor Note: Availability: Unix. Click me to see the sample solution
105. Write a Python program to get the users environment. Go to the editor Click me to see the sample solution
106. Write a Python program to divide a path on the extension separator. Go to the editor Click me to see the sample solution
107. Write a Python program to retrieve file properties. Go to the editor Click me to see the sample solution
108. Write a Python program to find path refers to a file or directory when you encounter a path name. Go to the editor Click me to see the sample solution
109. Write a Python program to check if a number is positive, negative or zero. Go to the editor Click me to see the sample solution
110. Write a Python program to get numbers divisible by fifteen from a list using an anonymous function. Go to the editor Click me to see the sample solution
111. Write a Python program to make file lists from current directory using a wildcard. Go to the editor Click me to see the sample solution
112. Write a Python program to remove the first item from a specified list. Go to the editor Click me to see the sample solution
113. Write a Python program to input a number, if it is not a number generates an error message. Go to the editor Click me to see the sample solution
114. Write a Python program to filter the positive numbers from a list. Go to the editor Click me to see the sample solution
115. Write a Python program to compute the product of a list of integers (without using for loop). Go to the editor Click me to see the sample solution
116. Write a Python program to print Unicode characters. Go to the editor Click me to see the sample solution
117. Write a Python program to prove that two string variables of same value point same memory location. Go to the editor Click me to see the sample solution
118. Write a Python program to create a bytearray from a list. Go to the editor Click me to see the sample solution
119. Write a Python program to round a floating-point number to specified number decimal places. Go to the editor Click me to see the sample solution
120. Write a Python program to format a specified string limiting the length of a string. Go to the editor Click me to see the sample solution
121. Write a Python program to determine whether variable is defined or not. Go to the editor Click me to see the sample solution
122. Write a Python program to empty a variable without destroying it. Go to the editor
Sample data: n=20 d = {"x":200} Expected Output : 0 {}
Click me to see the sample solution
123. Write a Python program to determine the largest and smallest integers, longs, floats. Go to the editor Click me to see the sample solution
124. Write a Python program to check whether multiple variables have the same value. Go to the editor Click me to see the sample solution
125. Write a Python program to sum of all counts in a collections.Go to the editor Click me to see the sample solution
126. Write a Python program to get the actual module object for a given object. Go to the editor Click me to see the sample solution
127. Write a Python program to check whether an integer fits in 64 bits. Go to the editor Click me to see the sample solution
128. Write a Python program to check whether lowercase letters exist in a string. Go to the editor Click me to see the sample solution
129. Write a Python program to add leading zeroes to a string. Go to the editor Click me to see the sample solution
130. Write a Python program to use double quotes to display strings. Go to the editor Click me to see the sample solution
131. Write a Python program to split a variable length string into variables. Go to the editor Click me to see the sample solution
132. Write a Python program to list home directory without absolute path. Go to the editor Click me to see the sample solution
133. Write a Python program to calculate the time runs (difference between start and current time) of a program. Go to the editor Click me to see the sample solution
134. Write a Python program to input two integers in a single line. Go to the editor Click me to see the sample solution
135. Write a Python program to print a variable without spaces between values. Go to the editor Sample value : x =30 Expected output : Value of x is "30" Click me to see the sample solution
136. Write a Python program to find files and skip directories of a given directory. Go to the editor Click me to see the sample solution
137. Write a Python program to extract single key-value pair of a dictionary in variables. Go to the editor Click me to see the sample solution
138. Write a Python program to convert true to 1 and false to 0. Go to the editor Click me to see the sample solution
139. Write a Python program to valid a IP address. Go to the editor Click me to see the sample solution
140. Write a Python program to convert an integer to binary keep leading zeros. Go to the editor Sample data : x=12 Expected output : 00001100 0000001100 Click me to see the sample solution
141. Write a python program to convert decimal to hexadecimal. Go to the editor Sample decimal number: 30, 4 Expected output: 1e, 04 Click me to see the sample solution
142. Write a Python program to find the operating system name, platform and platform release date. Go to the editor Operating system name: posix Platform name: Linux Platform release: 4.4.0-47-generic Click me to see the sample solution
143. Write a Python program to determine if the python shell is executing in 32bit or 64bit mode on operating system. Go to the editor Click me to see the sample solution
144. Write a Python program to check whether variable is integer or string. Go to the editor Click me to see the sample solution
145. Write a Python program to test if a variable is a list or tuple or a set. Go to the editor Click me to see the sample solution
146. Write a Python program to find the location of Python module sources. Go to the editor Click me to see the sample solution
147. Write a Python function to check whether a number is divisible by another number. Accept two integers values form the user. Go to the editor Click me to see the sample solution
148. Write a Python function to find the maximum and minimum numbers from a sequence of numbers. Go to the editor Note: Do not use built-in functions. Click me to see the sample solution
149. Write a Python function that takes a positive integer and returns the sum of the cube of all the positive integers smaller than the specified number. Go to the editor Click me to see the sample solution
150. Write a Python function to check whether a distinct pair of numbers whose product is odd present in a sequence of integer values. Go to the editor Click me to see the sample solution