Only Few Seats Left for Advanced Certification Courses on Data Science, ML & AI by E&ICT Academy IIT Roorkee

  Apply Now

Python - Variable Assignment

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.

INSTRUCTIONS

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)


No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...