Coding Category Archives - General Assembly Blog | Page 5

How is Python Used in Data Science?

By

Python is a popular programming language used by both developers and data scientists. But what makes it so popular and why are so many data scientists choosing Python over other programming languages? In this article, we’ll explore the advantages of Python programming and why it’s useful for data science.

What is Python?

No, we’re not talking about the giant, tropical snake. Python is a general-purpose, high-level programming language. It supports object oriented, structured, and functional programming paradigms.

Python was created in the late 1980s by the Dutch programmer Guido van Rossum who wanted a project to fill his time over the holiday break. His goal was to create a programming language that was a descendant of the ABC programming language but would appeal to Unix/C hackers. Van Rossum writes that he chose the name Python for this language, “being in a slightly irreverent mood (and a big fan of Monty Python’s Flying Circus).”

Python went through many updates and iterations and by the year 2008, Python 3.0 was released. This was designed to fix many of the design flaws in the language, with an emphasis on removing redundant features. While this update had some growing pains as it was not backwards compatible, the new updates made way for Python as we know it today. It continues to be well-maintained and supported as a popular, open source programming language.

In “The Zen of Python,” developer Tim Peters summarizes van Rossum’s guiding principles for writing code in Python:

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea — let’s do more of those!

These principles touch on some of the advantages of Python in data science. Python is designed to be readable, simple, explicit, and explainable. Even the first principle states that Python code should be beautiful. In general, Python is a great programming language for many tasks and is becoming increasingly popular for developers. But now you may be wondering, why learn Python for data science?

Why Python for Data Science?

The first of many benefits of Python in data science is its simplicity. While some data scientists come from a computer science background or know other programming languages, many come from backgrounds in statistics, mathematics, or other technical fields and may not have as much coding experience when they enter the field of data science. Python syntax is easy to follow and write, which makes it a simple programming language to get started with and learn quickly. 

In addition, there are plenty of free resources available online to learn Python and get help if you get stuck. Python is an open source language, meaning the language is open to the public and freely available. This is beneficial for data scientists looking to learn a new language because there is no up-front cost to start learning Python. This also means that there are a lot of data scientists already using Python, so there is a strong community of both developers and data scientists who use and love Python.

The Python community is large, thriving, and welcoming. Python is the fourth most popular language among all developers based on a 2020 Stack Overflow survey of nearly 65,000 developers. Python is especially popular among data scientists. According to SlashData, there are 8.2 million active Python users with “a whopping 69% of machine learning developers and data scientists now us[ing] Python (compared to 24% of them using R).”4 A large community brings a wealth of available resources to Python users. Not only are there numerous books and tutorials available, there are also conferences such as PyCon where Python users across the world can come together to share knowledge and connect. Python has created a supportive and welcoming community of data scientists willing to share new ideas and help one another. 

If the sheer number of people using Python doesn’t convince you of the importance of Python for data science, maybe the libraries available to make your data science coding easier will. A library in Python is a collection of modules with pre-built code to help with common tasks. They essentially allow us to benefit from and build on top of the work of others. In other languages, some data science tasks would be cumbersome and time consuming to code from scratch. There are countless libraries like NumPy, Pandas, and Matplotlib available in Python to make data cleaning, data analysis, data visualization, and machine learning tasks easier. Some of the most popular libraries include:

  • NumPy: NumPy is a Python library that provides support for many mathematical tasks on large, multidimensional arrays and matrices.
  • Pandas: The Pandas library is one of the most popular and easy-to-use libraries available. It allows for easy manipulation of tabular data for data cleaning and data analysis.
  • Matplotlib: This library provides simple ways to create static or interactive boxplots, scatterplots, line graphs, and bar charts. It’s useful for simplifying your data visualization tasks.
  • Seaborn: Seaborn is another data visualization library built on top of Matplotlib that allows for visually appealing statistical graphs. It allows you to easily visualize beautiful confidence intervals, distributions, and other graphs.
  • Statsmodels: This statistical modeling library builds all of your statistical models and statistical tests including linear regression, generalized linear models, and time series analysis models.
  • Scipy: Scipy is a library used for scientific computing that helps with linear algebra, optimization, and statistical tasks.
  • Requests: This is a useful library for scraping data from websites. It provides a user-friendly and responsive way to configure HTTP requests.

In addition to all of the general data manipulation libraries available in Python, a major advantage of Python in data science is the availability of powerful machine learning libraries. These machine learning libraries make data scientists’ lives easier by providing robust, open source libraries for any machine learning algorithm desired. These libraries offer simplicity without sacrificing performance. You can easily build a powerful and accurate neural network using these frameworks. Some of the most popular machine learning and deep learning libraries in Python include:

  • Scikit-learn: This popular machine learning library is a one-stop-shop for all of your machine learning needs with support for both supervised and unsupervised tasks. Some of the machine learning algorithms available are logistic regression, k-nearest neighbors, support vector machine, random forest, gradient boosting, k-means, DBSCAN, and principal component analysis.
  • Tensorflow: Tensorflow is a high-level library for building neural networks. Since it was mostly written in C++, this library provides us with the simplicity of Python without sacrificing power and performance. However, working with raw Tensorflow is not suited for beginners.
  • Keras: Keras is a popular high-level API that acts as an interface for the Tensorflow library. It’s a tool for building neural networks using a Tensorflow backend that’s extremely user friendly and easy to get started with.
  • Pytorch: Pytorch is another framework for deep learning created by Facebook’s AI research group. It provides more flexibility and speed than Keras, but since it has a low-level API, it is more complex and may be a little bit less beginner friendly than Keras. 

What Other Programming Languages are Used for Data Science?

Python is the most popular programming language for data science. If you’re looking for a new job as a data scientist, you’ll find that Python is also required in most job postings for data science roles. Jeff Hale, a General Assembly data science instructor, scraped job postings from popular job posting sites to see what was required for jobs with the title of “Data Scientist.” Hale found that Python appears in nearly 75% of all job postings. Python libraries including Tensorflow, Scikit-learn, Pandas, Keras, Pytorch, and Numpy also appear in many data science job postings.

Image source: The Most In-Demand Tech Skills for Data Scientists by Jeff Hale

R, another popular programming language for data science, appeared in roughly 55% of the job postings. While R is a useful tool for data science and has many benefits including data cleaning, data visualization, and statistical analysis, Python continues to become more popular and preferred among data scientists for a majority of tasks. In fact, the average percentage of job postings requiring R dropped by about 7% between 2018 and 2019, while Python increased in the percentage of job postings requiring the language. This isn’t to say that learning R is a waste of time; data scientists that know both of these languages can benefit from the strengths of both languages for different purposes. However, since Python is becoming increasingly popular, there’s a high chance that your team uses Python, and it’s important to use the language that your team is comfortable with and prefers.

What is the Future of Python for Data Science?

As Python continues to grow in popularity and as the number of data scientists continues to increase, the use of Python for data science will inevitably continue to grow. As we advance machine learning, deep learning, and other data science tasks, we’ll likely see these advancements available for our use as libraries in Python. Python has been well-maintained and continuously growing in popularity for years, and many of the top companies use Python today. With its continued popularity and growing support, Python will be used in the industry for years to come.

Whether you’ve been a data scientist for years or you are just beginning your data science journey, you can benefit from learning Python for data science. The simplicity, readability, support, community, and popularity of the language — as well as the libraries available for data cleaning, visualization, and machine learning — all set Python apart from other programming languages. If you aren’t already using Python for your work, give it a try and see how it can simplify your data science workflow.

The Newbie’s Guide to Android Development

By

Android101_DripArt1

This is the first post in our Android 101 series. Sign up to learn more about the world’s most popular operating system. 

In the last 10 years, Android has made a name for itself, not only with its candy-themed platform updates, but also with its widespread, and unexpected, success. In its lifetime, the open-source Android operating system has grown to include 1.4 billion active users and 80% of smartphones today run Android software. Over 1 billion Android phones were sold in 2014 alone.

Mobile app development in the programming community is the minority – just over 9% of total developers in the world say they’re focusing on mobile devices, according to Stack Overflow’s 2015 developer survey. Of these mobile developers, however, Android developers make up the larger group, with 44.6% self-identifying as Android developers, compared to 33.4% who say they are building for iOS. Even so, many companies struggle to find enough developers with the technical skills to complete their Android projects. This trend is likely to continue as the overall number of smartphone users – and Android users, specifically – continues to grow.

Continue reading

4 Tips for Preparing for a Coding Interview

By

If you’re applying for a software engineering position, chances are you’ll encounter some technical interview or coding challenge. For newer engineers applying for software programming roles, the coding interview is often the most terrifying part.

However, with a few interview preparation tips and things to consider, the technical interview will seem a lot less scary and will hopefully be a valuable learning opportunity during your job search. Let’s break down a few helpful tips:

1. Essential Hard Skills for a Coding Interview

Get in the habit of regularly doing code challenges. It’s a much more effective way to prepare for coding interview questions than trying to cram a bunch of studying in before the big day.

It’s important to schedule time each day to attempt at least one code challenge. You’ll get better at solving them, and you’ll also get better at outlining your process and speaking to it. A few great websites to help you practice code challenges in varying degrees of difficulty include LeetCode, Codewars, and AlgoExpert.

These code challenges help build the essential hard skills you need to perform well in a coding interview technically. If you’re applying for a mid-level position as a software engineer, you’ll want to feel pretty solid with these types of practice problems in your interview preparation. If you’re gearing up for your first technical interview as a junior engineer, you’ll want at least some exposure and practice with these. 

2. Prepare your Technical Interview with Strong Soft Skills

Coding challenges are important, but mastering them is only part of the preparation for coding interviews. Don’t overlook the significance of soft skills. During the interview process, including the technical coding interview, interviewers seek more than just coding abilities.

These other skills have to do with how well you communicate your thought process, collaborate, talk about the problem at hand, your leadership skills, your drive to learn, and generally speaking, how nice you are. Soft skills are often overlooked by candidates and can be deal breakers for a lot of coding interviews.

A company that’s worth applying to will want candidates that have strong soft skills, sometimes more so than hard skills, because they show how well a person can grow within the company and develop those hard skills over time. This is especially the case for junior software engineers.

When you practice your code challenges, see if you can buddy up with someone and take turns doing mock interview. Practice talking through the coding problem as you work, asking questions, giving each other hints here and there, and revealing your ability to lead, collaborate, and persevere through the coding test.

3. Acknowledge multiple solutions

The ideal candidate for an interviewer is not only skilled and a good fit for the company culture but also capable of defending their solution and considering alternative approaches. This demonstrates that they have a broader understanding beyond what they were taught or read online, and they recognize that there can be multiple solutions to a problem depending on the context.

As an interviewer, I value simplicity in a candidate’s solution because it allows for more discussion time. However, if a candidate can also propose alternative approaches and explain their choice, it’s a definite win.

For example, when tasked with designing a search function for a video streaming app, a candidate may opt for a quick but inefficient algorithm during the interview, while acknowledging a more suitable algorithm for real-world usage.

Speaking of algorithms…

4. Study your algorithms and data structures

This goes hand-in-hand with the hard skills but deserves its own section. You don’t need to be a master of computer science to ace a coding interview, but there are some standard algorithms and data structures that you should feel good about referencing, or at least mentioning and talking about. For instance:

  • How does a bubble sort work vs. a merge sort?
  • What’s the difference between a stack and a queue?
  • What’s a linked list? What about a hash table?

It’s likely that you’ll be asked one algorithm question in a job interview, so becoming familiar with and being able to speak about them to a degree is a good thing. Cracking The Code Interview by Gayle Laakmann McDowell is a great book covering all of the essential algorithms, data structures, and how to implement and use them in sample code challenges.

The coding interview is an opportunity for you to not only show off your skills as an engineer, but also to demonstrate how well you work with others as a data scientist. It’s designed to simulate what it’s like to work with you on a team. So be yourself, study, know the programming language(s) and practice, take a deep breath, and crush that coding interview!


How to Run a Python Script

By

As a blooming Python developer who has just written some Python code, you’re immediately faced with the important question, “how do I run it?” Before answering that question, let’s back up a little to cover one of the fundamental elements of Python.

An Interpreted Language

Python is an interpreted programming language, meaning Python code must be run using the Python interpreter.

Traditional programming languages like C/C++ are compiled, meaning that before it can be run, the human-readable code is passed into a compiler (special program) to generate machine code – a series of bytes providing specific instructions to specific types of processors. However, Python is different. Since it’s an interpreted programming language, each line of human-readable code is passed to an interpreter that converts it to machine code at run time.

So to run Python code, all you have to do is point the interpreter at your code.

Different Versions of the Python Interpreter

It’s critical to point out that there are different versions of the Python interpreter. The major Python version you’ll likely see is Python 2 or Python 3, but there are sub-versions (i.e. Python 2.7, Python 3.5, Python 3.7, etc.). Sometimes these differences are subtle. Sometimes they’re dramatically different. It’s important to always know which Python version is compatible with your Python code.

Run a script using the Python interpreter

To run a script, we have to point the Python interpreter at our Python code…but how do we do that? There are a few different ways, and there are some differences between how Windows and Linux/Mac operating systems do things. For these examples, we’re assuming that both Python 2.7 and Python 3.5 are installed.

Our Test Script

For our examples, we’re going to start by using this simple script called test.py.

test.py
print(“Aw yeah!”)'

How to Run a Python Script on Windows

The py Command

The default Python interpreter is referenced on Windows using the command py. Using the Command Prompt, you can use the -V option to print out the version.

Command Prompt
> py -V
Python 3.5

You can also specify the version of Python you’d like to run. For Windows, you can just provide an option like -2.7 to run version 2.7.

Command Prompt
> py -2.7 -V
Python 2.7

On Windows, the .py extension is registered to run a script file with that extension using the Python interpreter. However, the version of the default Python interpreter isn’t always consistent, so it’s best to always run your scripts as explicitly as possible.

To run a script, use the py command to specify the Python interpreter followed by the name of the script you want to run with the interpreter. To avoid using the full file path to your script (i.e. X:\General Assembly\test.py), make sure your Command Prompt is in the same directory as your Python script file. For example, to run our script test.py, run the following command:

Command Prompt
> py -3.5 test.py
Aw yeah!

Using a Batch File

If you don’t want to have to remember which version to use every time you run your Python program, you can also create a batch file to specify the command. For instance, create a batch file called test.bat with the contents:

test.bat
@echo off
py -3.5 test.py

This file simply runs your py command with the desired options. It includes an optional line “@echo off” that prevents the py command from being echoed to the screen when it’s run. If you find the echo helpful, just remove that line.

Now, if you want to run your Python program test.py, all you have to do is run this batch file.

Command Prompt
> test.bat
Aw yeah!

How to Run a Python Script on Linux/Mac

The py Command

Linux/Mac references the Python interpreter using the command python. Similar to the Windows py command, you can print out the version using the -V option.

Terminal
$ python -V
Python 2.7

For Linux/Mac, specifying the version of Python is a bit more complicated than Windows because the python commands are typically a bunch of symbolic links (symlinks) or shortcuts to other commands. Typically, python is a symlink to the command python2, python2 is a symlink to a command like python2.7, and python3 is a symlink to a command like python3.5. One way to view the different python commands available to you is using the following command:

Terminal
$ ls -1 $(which python)* | egrep ‘python($|[0-9])’ | egrep -v config
/usr/bin/python
/usr/bin/python2
/usr/bin/python2.7
/usr/bin/python3
/usr/bin/python3.5

To run our script, you can use the Python interpreter command and point it to the script.

Terminal
$ python3.5 test.py
Aw yeah!

However, there’s a better way of doing this.

Using a shebang

First, we’re going to modify the script so it has an additional line at the top starting with ‘#!’ and known as a shebang (shebangs, shebangs…).

test.py
#!/usr/bin/env python3.5
print(“Aw yeah!”)

This special shebang line tells the computer how to interpret the contents of the file. If you executed the file test.py without that line, it would look for special instruction bytes and be confused when all it finds is a text file. With that line, the computer knows that it should run the contents of the file as Python code using the Python interpreter.

You could also replace that line with the full file path to the interpreter:

#!/usr/bin/python3.5

However, different versions of Linux might install the Python interpreter in different locations, so this method can cause problems. For maximum portability, I always use the line with /usr/bin/env that looks for the python3.5 command by searching the PATH environment variable, but the choice is up to you.

Next, we’re going to set the permissions of this file to be Python executable with this command:

Terminal
$ chmod +x test.py

Now we can run the program using the command ./test.py!

Terminal
$ ./test.py
Aw yeah!

Pretty sweet, eh?

Run the Python Interpreter Interactively

One of the awesome things about Python is that you can run the interpreter in an interactive mode. Instead of using your py or python command pointing to a file, run it by itself, and you’ll get something that looks like this:

Command Prompt
> py
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Now you get an interactive command prompt where you can type in individual lines of Python!

Command Prompt (Python Interpreter)
>>> print(“Aw yeah!”)
Aw yeah!

What’s great about using the interpreter in interactive mode is that you can test out individual lines of Python code without writing an entire program. It also remembers what you’ve done, just like in a script, so things like functions and variables work the exact same way.

Command Prompt (Python Interpreter)
>>> x = "Still got it."
>>> print(x)
Still got it.

How to Run a Python Script from a Text Editor

Depending on your workflow, you may prefer to run your Python program or Python script file directly from your text editor. Different text editors provide fancy ways of doing the same thing we’ve already done — pointing the Python interpreter at your Python code. To help you along, I’ve provided instructions on how to do this in four popular text editors.

  1. Notepad++
  2. VSCode
  3. Sublime Text
  4. Vim

1. Notepad++

Notepad++ is my favorite general purpose text editor to use on Windows. It’s also super easy to run a Python program from it.

Step 1: Press F5 to open up the Run… dialogue

Step 2: Enter the py command like you would on the command line, but instead of entering the name of your script, use the variable FULL_CURRENT_PATH like so:

py -3.5 -i "$(FULL_CURRENT_PATH)"

You’ll notice that I’ve also included a -i option to our py command to “inspect interactively after running the script”. All that means is it leaves the command prompt open after it’s finished, so instead of printing “Aw yeah!” and then immediately quitting, you get to see the Python program’s output.

Step 3: Click Run

2. VSCode

VSCode is a Windows text editor designed specifically to work with code, and I’ve recently become a big fan of it. Running a Python program from VSCode is a bit complicated to set it up, but once you’ve done that, it works quite nicely.

Step 1: Go to the Extensions section by clicking this symbol or pressing CTRL+SHIFT+X.

Step 2: Search and install the extensions named Python and Code Runner, then restart VSCode.

Step 3: Right click in the text area and click the Run Code option or press CTRL+ALT+N to run the code.

Note: Depending on how you installed Python, you might run into an error here that says ‘python’ is not recognized as an internal or external command. By default, Python only installs the py command, but VSCode is quite intent on using the python command which is not currently in your PATH. Don’t worry, we can easily fix that.

Step 3.1: Locate your Python installation binary or download another copy from www.python.org/downloads. Run it, then select Modify.

Step 3.2: Click next without modifying anything until you get to the Advanced Options, then check the box next to Add Python to environment variables. Then click Install, and let it do its thing.

Step 3.3: Go back to VSCode and try again. Hopefully, it should now look a bit more like this:

A screenshot of a code editor showing how to run a Python script.

3. Sublime Text

Sublime Text is a popular text editor to use on Mac, and setting it up to run a Python program is super simple.

Step 1: In the menu, go to Tools → Build System and select Python.

A screenshot of a code editor showing how to run a Python script.

Step 2: Press command +b or in the menu, go to Tools → Build.

4. Vim

Vim is my text editor of choice when it comes to developing on Linux/Mac operating systems, and it can also be used to easily run a Python program.

Step 1: Enter the command :w !python3 and hit enter.

A terminal window showing how to run a Python script.

Step 2: Profit.

A terminal window showing how to run a Python script.

Now that you can successfully run your Python code, you’re well on your way to speaking parseltongue!

– – – – –

A Beginner’s Guide to Learn Python Programming

By

Estimated reading time: 7 minutes

WHAT IS PYTHON?: AN INTRODUCTION

Python is one of the most popular and user-friendly programming languages out there. As a developer who’s learned a number of programming languages, Python is one of my favorites due to its simplicity and power. Whether I’m rapidly prototyping a new idea or developing a robust piece of software to run in production, Python is usually my language of choice.

The Python programming language is ideal for folks first learning to program. It abstracts away many of the more complicated elements of computer programming that can trip up beginners, and this simplicity gets you up-and-running much more quickly!

For instance, the classic “Hello world” program (it just prints out the words “Hello World!”) looks like this in C:

However, to understand everything that’s going on, you need to understand what #include means (am I excluding anyone?), how to declare a function, why there’s an “f” appended to the word “print,” etc., etc.

Not only is this an easier starting point, but as the complexity of your Python programming grows, this simplicity will make sure you’re spending more time writing awesome code and less time tracking down bugs! 

Since Python is popular and open-source, there’s a thriving community of Python application developers online with extensive forums and documentation for whenever you need help. No matter what your issue is, the answer is usually only a quick Google search away.

If you’re new to programming or just looking to add another language to your arsenal, I would highly encourage you to join our community.

What Type of Language is Python?

Named after the classic British comedy troupe Monty Python, Python is a general-purpose, interpreted, object-oriented, high-level programming language with dynamic semantics. That’s a bit of a mouthful, so let’s break it down.

General-Purpose

Python is a general-purpose language which means it can be used for a wide variety of development tasks. Unlike a domain-specific language that can only be used for specific types of applications (think JavaScript and HTML/CSS for web development), a general-purpose language like Python can be used for:

Web applications: Popular frameworks like the Django web application and Flask are written in Python.

Desktop applications: The Dropbox client is written in Python.

Scientific and numeric computing: Python is the top choice for data science and machine learning.

Cybersecurity: Python is excellent for data analysis, writing system scripts that interact with an operating system, and communicating over network sockets.

Interpreted

Python is an interpreted language, meaning Python program code must be run using the Python interpreter.

Traditional programming languages like C/C++ are compiled, meaning that before it can be run, the human-readable code is passed into a compiler (special program) to generate machine code — a series of bytes providing specific instructions to specific types of processors. However, Python is different. Since it’s an interpreted programming language, each line of human-readable code is passed to an interpreter that converts it to machine code at run time.

In other words, instead of having to go through the sometimes complicated and lengthy process of compiling your code before running it, you just point the Python interpreter at your code, and you’re off!

Part of what makes an interpreted language great is how portable it is. Compiled languages must be compiled for the specific type of computer they’re run on (i.e. think your phone vs. your laptop). For Python, as long as you’ve installed the interpreter for your computer, the exact same code will run almost anywhere!

Object-Oriented

Python is an Object-Oriented Programming (OOP) language which means that all of its elements are broken down into things called objects. A Python object is very useful for software architecture and often makes it simpler to write large, complicated applications. 

High-Level

Python is a high-level language which really just means that it’s simpler and more intuitive for a human to use. Low-level languages such as C/C++ require a much more detailed understanding of how a computer works. With a high-level language, many of these details are abstracted away to make your life easier.

For instance, say you have a list of three numbers — 1, 2, and 3 — and you want to append the number 4 to that list. In C, you have to worry about how the computer uses memory, understands different types of variables (i.e., an integer vs. a string), and keeps track of what you’re doing.

Implementing this in C code is rather complicated:

However, implementing this in Python code is much simpler:

Since a list in Python is an object, you don’t need to specifically define what the data structure looks like or explain to the computer what it means to append the number 4. You just say “list.append(4)”, and you’re good.

Under the hood, the computer is still doing all of those complicated things, but as a developer, you don’t have to worry about them! Not only does that make your code easier to read, understand, and debug, but it means you can develop more complicated programs much faster.

Dynamic Semantics

Python uses dynamic semantics, meaning that its variables are dynamic objects. Essentially, it’s just another aspect of Python being a high-level language.

In the list example above, a low-level language like C requires you to statically define the type of a variable. So if you defined an integer x, set x = 3, and then set x = “pants”, the computer will get very confused. However, if you use Python to set x = 3, Python knows x is an integer. If you then set x = “pants”, Python knows that x is now a string.

In other words, Python lets you assign variables in a way that makes more sense to you than it does to the computer. It’s just another way that Python programming is intuitive.

It also gives you the ability to do something like creating a list where different elements have different types like the list [1, 2, “three”, “four”]. Defining that in a language like C would be a nightmare, but in Python, that’s all there is to it.

Being so powerful, flexible, and user-friendly, the Python language has become incredibly popular. Python’s popularity is important for a few reasons.

Python Programming is in Demand

If you’re looking for a new skill to help you land your next job, learning Python is a great move. Because of its versatility, Python is used by many top tech companies. Netflix, Uber, Pinterest, Instagram, and Spotify all build their applications using Python. It’s also a favorite programming language of folks in data science and machine learning, so if you’re interested in going into those fields, learning Python is a good first step. With all of the folks using Python, it’s a programming language that will still be just as relevant years from now.

Dedicated Community

Python developers have tons of support online. It’s open-source with extensive documentation, and there are tons of articles and forum posts dedicated to it. As a professional Python developer, I rely on this community everyday to get my code up and running as quickly and easily as possible.

There are also numerous Python libraries readily available online! If you ever need more functionality, someone on the internet has likely already written a library to do just that. All you have to do is download it, write the line “import <library>”, and off you go. Part of Python’s popularity in data science and machine learning is the widespread use of its libraries such as NumPy, Pandas, SciPy, and TensorFlow.

Conclusion

Python is a great way to start programming and a great tool for experienced developers. It’s powerful, user-friendly, and enables you to spend more time writing badass code and less time debugging it. With all of the libraries available, it will do almost anything you want it to.

The final answer to the question “What is Python”? Awesome. Python is awesome.

Getting Started with Sublime Text 3: 25 Tips, Tricks, and Shortcuts

By

Computer with blinking text selector

Note: Sublime Text 4 has since been released and is available here.

Sublime Text 3 (ST3) is the former version of one of the most commonly used plain text editors by web developers, coders, and programmers. It is a source code editor that has a Python programming surface or API. It is able to support C++ and the Python programming language. Plus, functions can be added by any user with a plugin.

Make the most of ST3 with the 25 tips and tricks in this ultimate guide for web developers. Learn not only how to use Sublime Text 3, but also about must-have packages, useful keyboard shortcuts, and more.

1. User Preference Settings

By default, ST3 uses hard-tabs that are 4 characters long. This can result in hard-to-read code, as large tabular indents push your work to the right. I recommend all developers add this to their user settings (Sublime Text 3 => Preferences => Settings – User):

  {
    "draw_white_space": "all",
    "rulers": [80],
    "tab_size": 2,
    "translate_tabs_to_spaces": true
  }

This setting converts hard-tabs to spaces, makes indents only two characters long, puts a ruler at the 80 character mark (to remind you to keep your code concise), and adds white space markers. Here is a complete list of preference options if you wish to continue customizing your ST3 environment.
Continue reading

7 Essential Skills You Need to be an Android Developer

By

Android 101 - Skills for Android Developers. A graphic of the Android posting to a chart.

Building Android applications requires a deep understanding of programming and design. When approaching a new technology for the first time, it often helps to break it down into pieces. If you’re an experienced web developer, many of the concepts and technologies involved in Android app development will be analogous to things you already know – although building apps for mobile devices often requires mastery of a number of more nuanced concepts. Mobile devices have smaller screens, simpler processors, and – in the case of Android – many different manufacturers.That means that developers need to keep code flexible and account for various user interface scenarios. So what are the must-have skills for Android developers? We asked some of the brightest developers in our community – here’s what you need to know.

Continue reading

5 Reasons You Should Learn to Code

By

learning to code

Why learn to code? There’s no denying that full-stack web development is one of today’s most sought-after careers. With a median salary of more than $75,000 and demand expected to grow 27% from 2014-2024, according to the U.S. Bureau of Labor Statistics, full-stack web development is a smart career path for many individuals.

But even if you’re not planning on becoming a full-time programmer or coder, learning how to code and having that kind of knowledge and experience can have substantial benefits for your career and further job opportunities. In today’s competitive job market, the smartest workers are those who are able to leverage technology to their advantage — no matter their job title.

Not sure if you want to tackle the challenge? Here are five reasons and benefits of learning to code that will add serious value to your career.

Continue reading

HTML for Web Development: Building the Bones of Your Website

By

Hypertext Markup Language, or HTML, is a programming language used to describe the structure of information on a webpage. Together, HTML, CSS, and JavaScript make up the essential building blocks of websites worldwide, with CSS controlling a page’s appearance and JavaScript programming its functionality.

Why Is HTML Important?

You can think of HTML development as providing the bones of a webpage, while CSS provides the skin, and JavaScript provides the brains. A webpage can contain headings, paragraphs, images, videos, and many other types of data. Front-end developers use the HTML element to specify what kind of information each item on a webpage contains — for instance, the “p” HTML element indicates a paragraph. Developers also write HTML language code to specify how different items relate to one another in the page’s overall structure or document structure.

Every website you open in your web browser, from social networks to music services, uses HTML. A look under the hood of any website would reveal a basic HTML code page, written with an HTML structure editor, providing structure for all the page’s components, including its header element, footer element, main content, and other inline elements.

A look at the HTML code that structures General Assembly’s website.
A look at the HTML code that structures General Assembly’s website.

How HTML Works in a Webpage

The HTML file plays a couple of significant roles in a webpage. First, we use the structure created by our HTML code to reference, enhance, and manipulate elements on a web page using CSS and JavaScript. For instance, you could use HTML to mark all of the headings on a web browser page, then pick the size and color you want to apply to those headings to reflect your organization’s branding, or simply a visual design developed for the site.
Second, HTML text lets us indicate the roles of different structural elements to search engines and other services that index the content and summarize it for other users. For instance, marking the caption of an image with the “figcaption” element and enclosing the image and its caption in the “figure” meta element helps a search engine understand that these two pieces of content are related and that the caption describes the associated image.

Learning HTML at General Assembly

Whether you want to land a job as a front-end or full-stack web developer or just want to dip your toe into programming, HTML is a natural place to start. Learning HTML, along with CSS and basic JavaScript, provides you with the fundamental skills necessary to create your interactive single-page website.

In GA’s part-time courses in Front-End Web Development and HTML, CSS & Web Design, and our career-changing, full-time Web Development Immersive program, you’ll get hands-on practice coding your projects, from static personal and business websites to single-page applications like games and interactive photo galleries.

These projects give you practice using basic HTML tags and structuring pages with different components, including headers, footers, sidebars, and navigation. You’ll also code CSS and JavaScript and learn how to put all three together to build websites that implement modern standards and use best practices for front-end development.

Meet Our Expert

Sasha Vodnik is a front-end web developer and author who teaches Front-End Web Development and JavaScript Development at General Assembly’s San Francisco campus. He also writes books on HTML, CSS, and JavaScript and creates video courses through Lynda.com.

“I love meeting students from a wide variety of industries, with a whole spectrum of goals, from all over the world. I’m continually inspired by the thoughtful, creative projects they build in the course that showcase their new skills and unique vision.”

– Sasha Vodnik, Front-End Web Development Instructor, General Assembly San Francisco

How the Marines Prepared Me for a Career in Coding

By

ga_militaryeducation-head

While stationed in Okinawa, Japan, in 2008, I wouldn’t have guessed that my time in the Marine Corps would have prepared me for a future in coding. At the time, the 30 Marines in my platoon had access to just one shared computer. It served only two functions: completing online training requirements, and looking up one’s online military record. I never suspected that nine years later I would be designing and building websites and applications in an intensive software engineering course, General Assembly’s Web Development Immersive, now called Software Engineering Immersive (SEI) course.

My path toward coding was a winding one. As a Marine on active duty, I was stationed in Japan, Kenya, Sudan, Italy, and Pakistan. Later, after transferring to the Marine Corps Reserve, I pursued a bachelor’s degree in international affairs from George Washington University. While studying at GW, I worked at the nonprofit Veterans Campaign, where I was tasked with helping to rebrand the organization. Though I had little technical experience, I created an entirely new web presence for the organization and migrated its old content to the new website.

Continue reading