Blog Detail

September 1, 2023

Python Data Types Exercises

  • When should we use the int data type in Python?



  • What is the primary purpose of the str data type in Python?



  • What is the data type of the file_name variable?

                    file_name = 'log.txt'
  • What is the data type of the max_attempts variable?

                    max_attempts = 3
  • What is the data type of the num_of_children?

                    num_of_children = '2'
  • What is the output of this code?

                    birth_year = 1990
    print(type(birth_year))
  • What is the output of this code?

                    department = 'Marketing'
    print(type(department))
  • Python Exercises for Data Types

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


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




    Happy Coding!
    Behnam Khani