Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
In Python, a variable allows us to refer to a value with a name. To create a variable use =
like below
x = 10
Here, we have assigned integer value 10
to variable x
.
Before you attempt this assessment, please note that you need to write your code in the Jupyter notebook given on the right side of this split screen and not in the comments section. Please use the comments section only if you are facing any challenges.
Create variables in the Jupyter notebook on the right-hand side. Press Shift + Enter
to run code in individual cells.
Create a variable my_int
with the value 20
. Since 20 is an integer, my_int
is an integer variable.
Create a variable my_float
with the value 15.85
. Here my_float
is a float variable.
Create a variable my_string
with value 'Hello World'
. Here my_string
is a string variable. In Python string can be defined using single or double quotes.
Create a variable my_bool
with the value True
. Here my_bool
is a boolean variable and represent the logical values True
or False
(Note the capitalization)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...