Blog Detail

September 1, 2023

Python Variable Exercises

  • Which function in Python is used to ask the user to enter information?



  • Get an email address from your user and print it.

                    email_address = ""()
    print(email_address)
  • Add a prompt message to the input() function.

                    email_address = input('')
    print(email_address)
  • What is the purpose of the argument passed to the input() function in Python?



  • How can we save the information entered by the user using the input() function?



  • What is the output of this program?

                    address_line_1 = '123 Main St.'
    address_line_2 = 'Apt 4B'
    
    full_address = address_line_1 + address_line_2
    
    print(full_address)
  • What is the output of this program?

                    address_line_1 = '123 Main St.'
    address_line_2 = 'Apt 4B'
    
    full_address = address_line_1 + ' ' + address_line_2
    
    print(full_address)
  • Is it possible to use spaces inside a string?



  • 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