## 9 – Strings

Often programming involves more than numbers and arithmetic. There may be situations where you need to work with text. To work with text in Python, you will need to use a string, which is an immutable ordered series of characters. More on the immutable ordered part later. You can create a string by using quotes. … Read more

## 8 – Boolean Comparison and Logical Operators

We’ve seen two kinds of Python data types so far, ints and floats and we’ve used arithmetic operators like addition and exponentiation to work with these values. Another type is Bool which is used to represent the values true and false. Bool is an abbreviation of boolean. Boolean Algebra is a branch of algebra dealing … Read more

## 7 – Whitespace

One thing you might have noticed is that in a single line of Python, whitespace doesn’t really affect how your code works. For example, this will give exactly the same output as this, however. That doesn’t mean that these lines are equally good lines of code. Learning how to write clear and readable code is … Read more

## 6 – Números inteiros e floats

So far, most of the numbers we’ve been working with have been whole numbers or integers. However, as you may have noticed other types of numbers do exist in Python. Here, dividing one integer by another gives us a number that isn’t an integer 0.75. In Python and computing in general, we represent such a … Read more

## 5 – Assignment Operators

We’ve already set mv_ population to this value. But what if we want to update it now that the population changed? We can just assign this variable again to its new value which we found to be 78,128 or if we got this new value because we knew 4,000 moved to Mountain View and 600 … Read more

## 4 – L2 04b Variables II V3

Python also has a useful way to assign multiple variables at once. These three assignments can be abbreviated using multiple assignments like this: x is still assigned to two, y to three, and z to five. You can use this when you’re assigning closely related variables like the width and height of an object or … Read more

## 3 – Variables

Understanding how to perform arithmetic in Python is useful. But understanding how to use variables can turn Python into more than just a calculator. Using variables, as opposed to just raw numbers, has many advantages. Let’s get started. Creating a new variable in Python is simple. Here’s one which stores the population of mountain view. … Read more

## 21 – Conclusion

Congratulations on completing this lesson on data types and operators. You started your journey in Python with a great foundation. Next, you’ll learn how to piece together the building blocks you just learned to write cooler and more complex programs. Great job.

## 20 – L2 01 Compound Data Structures V1

In the elements dictionary we saw earlier, element names which are strings are mapped to their atomic numbers which are integers. But what if we wanted to store more information about each element, like their weight and symbol. We can do that by adjusting this dictionary so that it maps the element names to another … Read more

## 2 – Arithmetic Operators

In the last video, you saw this line of Python that computes the sum of 3 and 5. The plus sign and this line is an arithmetic operator. Python has several arithmetic operators most of which follow the usual rules of Mathematics. Let’s look at the first four, in Python addition and subtraction are performed … Read more

## 19 – L2 02 Dictionaries And Identiy Operators V35

Sets, are simple data structures, and they have one main use, collecting unique elements. Our next data structures, dictionaries, are more flexible. Rather than storing single objects like lists and sets do, dictionaries store pairs of elements, keys and values. In this example, we define a dictionary, where the keys are element names, and their … Read more

## 19 – L2 02 Dictionaries And Identiy Operators V3

Sets, are simple data structures, and they have one main use, collecting unique elements. Our next data structures, dictionaries, are more flexible. Rather than storing single objects like lists and sets do, dictionaries store pairs of elements, keys and values. In this example, we define a dictionary, where the keys are element names, and their … Read more

## 18 – L2 03 Sets V2

Imagine that you run a popular search engine, and you’ve surveyed your users to see where they’re browsing from. You’ve collected the 785 responses and have assembled them into a list of countries. There aren’t 785 countries in the world, which means that there are duplicate entries in the country’s list. Slicing the list to … Read more

## 17 – L2 04 Tuples V3

Python provides another useful container, tuples. Tuples are used to store related pieces of information. A tuple is a data structure in Python that is an immutable ordered sequence of elements. Consider this example involving latitude and longitude. Tuples are similar to lists in that they store an ordered collection of objects which can be … Read more

## 16 – L2 05 Lists Methods V1

Let’s introduce a new string method that works with lists. Join. Join takes a list as an argument, and returns a string consisting of the list elements, joined by separator string. In this example, we use a string backslash and, as a separator, so that there’s a new line between each element. Fore newline, aft … Read more

## 15 – L2 06 Lists Methods V1

Previously, when we created a variable, that held an immutable object, the value of that immutable object was saved in memory. Here, we create a name with value Jim, and assign it to another variable, called Student. It is the value Jim, that is assigned to student. So, when we reassign name, to update it … Read more

## 14 – L2 07 Lists And Membership Operators II V3

So, how are list different from strings? You saw that both support indexing, slicing and the in operator. The most obvious difference, is that strings are sequences of letters while list elements can be any type of object. Or more subtle difference is that lists can be modified but strings can’t. Here, we can change … Read more

## 13 – L2 08 Lists And Membership Operators V2

In addition to accessing individual elements from a list, we can use Python slicing notation to access a subsequence of a list. Slicing means using indices to slice off parts of an object like a string or a list. An example makes it super clear. Again, consider this list of months. We can slice the … Read more

## 12 – L2 09 Lists And Membership Operators V2

We’ve seen individual pieces of data like a string or a number. These are great, but Python’s capability to write powerful programs is maximized when we can work with something called containers of data, which contain other datatypes and even other containers. So, let’s introduce our first Python container: lists. A list is a data … Read more

## 11 – String Methods

So far, we’ve seen two distinct ways to process data with Python, operators and functions. We’ve used operators like these, which process the two values on either side of the operator. We’ve also used functions like print and len. Functions are very similar to operators. In fact, the only real difference is in how they … Read more