Blog Detail

September 1, 2023

Python Variable Exercises

  • Select the variable name that is more descriptive and meaningful.

                    "" = 'C:\'
  • Which variable name is more descriptive for holding a total budget value?

  • Correct this code.

                    product''category = 'electronics'
    _ +
  • What’s wrong with this variable?

                    product category = 'electronics'
  • Complete the name of this variable by using snake case convention.

                    page""size = 'A4'
  • Use snake case convention to name this variable.

                    "" = 'Yesterday'
  • Use numbers to define related variables.

                    address_line_"" = "123 Main St."
    address_line_2 = "Apt 4B"
    address_line_3 = "Los Angeles, CA 90001"
  • Complete the third variable name.

                    security_question_1 = 'What is your favorite book?'
    security_question_2 = 'What is your favorite color?'
    security_question_"" = 'What was the name of your first pet?'
  • Python Exercises for Variables

    • If you’ve faced difficulties with these exercises, take a look at Variables Module on my Python course.

    You can also share ‘Python Variables’ Exercises on your:
    X (Twitter)TelegramLinkedinFacebook – or on your favorite platform…

    Happy Coding!
    Behnam Khani