Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Variables for String | Variables in Python
Python Tutorial for Beginners
course content

Contenido del Curso

Python Tutorial for Beginners

Python Tutorial for Beginners

1. Introduction to Programming
2. Variables in Python
3. Comments
4. If...Else Statement

Variables for String

What is a variable? In simple words, a variable is a data store. It is very easy to create a variable in Python - you need to assign a value to a certain identifier using the "=" assignment operator. Let's look at the example of how to create a variable.

If you display this variable on the screen, you will get such an output: Rose

Now the variable flower refers to the next line "Rose". But if you want to change the value of this variable you can do it very easily. Look at the example.

You have changed the variable. And if you display the variable flower on the screen, you will get: Lily.

Note that we have assigned string values to variables. And when we work with strings, we have to enclose them in quotes, if you don't, you will get an error.

It's time to practice!

Tarea

In this task, you need to implement 2 steps, namely:

  1. Create a variable named country. Assign the string "France" to this variable.
  2. Display this variable to the screen using print keyword.

Tarea

In this task, you need to implement 2 steps, namely:

  1. Create a variable named country. Assign the string "France" to this variable.
  2. Display this variable to the screen using print keyword.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 2. Capítulo 1
toggle bottom row

Variables for String

What is a variable? In simple words, a variable is a data store. It is very easy to create a variable in Python - you need to assign a value to a certain identifier using the "=" assignment operator. Let's look at the example of how to create a variable.

If you display this variable on the screen, you will get such an output: Rose

Now the variable flower refers to the next line "Rose". But if you want to change the value of this variable you can do it very easily. Look at the example.

You have changed the variable. And if you display the variable flower on the screen, you will get: Lily.

Note that we have assigned string values to variables. And when we work with strings, we have to enclose them in quotes, if you don't, you will get an error.

It's time to practice!

Tarea

In this task, you need to implement 2 steps, namely:

  1. Create a variable named country. Assign the string "France" to this variable.
  2. Display this variable to the screen using print keyword.

Tarea

In this task, you need to implement 2 steps, namely:

  1. Create a variable named country. Assign the string "France" to this variable.
  2. Display this variable to the screen using print keyword.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 2. Capítulo 1
toggle bottom row

Variables for String

What is a variable? In simple words, a variable is a data store. It is very easy to create a variable in Python - you need to assign a value to a certain identifier using the "=" assignment operator. Let's look at the example of how to create a variable.

If you display this variable on the screen, you will get such an output: Rose

Now the variable flower refers to the next line "Rose". But if you want to change the value of this variable you can do it very easily. Look at the example.

You have changed the variable. And if you display the variable flower on the screen, you will get: Lily.

Note that we have assigned string values to variables. And when we work with strings, we have to enclose them in quotes, if you don't, you will get an error.

It's time to practice!

Tarea

In this task, you need to implement 2 steps, namely:

  1. Create a variable named country. Assign the string "France" to this variable.
  2. Display this variable to the screen using print keyword.

Tarea

In this task, you need to implement 2 steps, namely:

  1. Create a variable named country. Assign the string "France" to this variable.
  2. Display this variable to the screen using print keyword.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

What is a variable? In simple words, a variable is a data store. It is very easy to create a variable in Python - you need to assign a value to a certain identifier using the "=" assignment operator. Let's look at the example of how to create a variable.

If you display this variable on the screen, you will get such an output: Rose

Now the variable flower refers to the next line "Rose". But if you want to change the value of this variable you can do it very easily. Look at the example.

You have changed the variable. And if you display the variable flower on the screen, you will get: Lily.

Note that we have assigned string values to variables. And when we work with strings, we have to enclose them in quotes, if you don't, you will get an error.

It's time to practice!

Tarea

In this task, you need to implement 2 steps, namely:

  1. Create a variable named country. Assign the string "France" to this variable.
  2. Display this variable to the screen using print keyword.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 2. Capítulo 1
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt