Halloween Sale: Flat 70% + Addl. 25% Off + 30 Days Extra Lab on all Courses | Use Coupon HS25 in Checkout | Offer Expires In

  Enroll 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.

  • 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...