0% found this document useful (0 votes)
63 views

Variable Assignment - Python PDF

This document discusses variable assignment in Python. It explains that a variable allows you to refer to a value with a name by using the assignment operator (=). The example creates a variable x and assigns it the value 5, so it can now use the name x instead of the actual value. The instructions then ask the user to create a variable called savings with a value of 100 and print it to check the variable.

Uploaded by

Moti King Moti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Variable Assignment - Python PDF

This document discusses variable assignment in Python. It explains that a variable allows you to refer to a value with a name by using the assignment operator (=). The example creates a variable x and assigns it the value 5, so it can now use the name x instead of the actual value. The instructions then ask the user to create a variable called savings with a value of 100 and print it to check the variable.

Uploaded by

Moti King Moti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1/2/2021 Variable Assignment | Python

Course Outline Daily XP 450

Exercise script.py
Variable Assignment 1 # Create a
In Python, a variable allows you to refer to a value with a name. 2 savings = 1
3
To create a variable use = , like this example:
4 # Print out
5 print(savin
x = 5

You can now use the name of this variable, x , instead of the
actual value, 5 .

Remember, = in Python means assignment, it doesn't test


equality!

Instructions 100 XP
IPython Shell Slides
• Create a variable savings with the value 100. print(10 / 2)
print(18 % 7)
• Check out this variable by typing print(savings) in the
print(4 ** 2)
script.

# How much is your


Take Hint (-30 XP)
print(100 * 1.1 **

In [1]:
;

https://campus.datacamp.com/courses/intro-to-python-for-data-science/chapter-1-python-basics?ex=7 1/1

You might also like