EdPresso shots are a new kind of Espresso shot but, instead of waking your body up with caffeine, they wake your mind up with knowledge. Just like shots of espresso, EdPresso shots are short and concentrated bits of coding knowledge, organized in an open-access library for developers of all skill levels. The time it takes to read one rarely exceeds four minutes, no matter the difficulty of the topic.
Also, like espresso shots, EdPressos come in many different flavors, some more popular than others. There are five shots that seem to have won over developers around the world. In this post, we will explore the top 5 questions searched by developers like you.
First, we define the difference between classes and objects: “an Object may contain data (fields or variables) or code (methods or procedures). The creation of these objects is based on a programmer-defined blue-print also known as a Class.” This shot then breaks down the four basic principles of OOP (Object-oriented programming): inheritance, polymorphism, abstraction, and encapsulation.
Since languages like Java, Smalltalk, Python, Fortran, Eiffel, etc. all use OOP, it makes a lot of sense that so many developers are curious about this shot.
The shot begins with a short definition of a command: is an instruction to the computer, which it interprets to perform a specific task. It then breaks down commands in detail, including Listing Files
ls, Change Directory
cd, Make Directory
mkdir, Remove Film
rm, and Manual
man. Under each command header, there is an explanation of why the command is used and a real-life example that you can compile on the webpage yourself.
Number 3 beings by defining strings: ordered sequences of character data.
In Python, there is no built-in method to reverse a string, but there are three different ways in which strings can be reversed (i.e., Slicing, Loop, and Use join). With Slicing, we simply create a slice that starts with the length of the string, and ends at index 0. With Loop, we create a new array called
reversedString and then loop over the list with iterating variable index initialized with the length of the list. With Use join, we use reverse iteration with the
reversed( ) built-in function to cycle through the elements in the string in reverse order and then use
.join() method to merge them.
If you want to get hands-on practice, take a look at shot and run the code in real-time.
First, we define a
switch statement: these are is used to transfer control to a particular block of code, based on the value of the variable being tested. They are an efficient alternative for
if-else statements. The switch is passed a variable, the value of which is compared with each case value. If there is a match, the corresponding block of code is executed.
This shot compares min and max heap with clear visuals and applications.
It then breaks down the time complexity for each.
You can learn more about this topic here.
Join a community of more than 1.3 million readers. A free, bi-monthly email with a roundup of Educative's top articles and coding tips.