Data Types

Data Types


Identify the data types for the following
  1. Total students present in the class
  2. Course code of a subject
  3. Room temperature
  4. NYU student ID
  5. Home address
  6. Day of the week (Sunday, Monday, etc)
  7. Price of a book
  8. CGPA of a student


For example, the variable fname is used to store the first name of a person. The first name of a person is of type text or string.

Rules for naming a Variable


Identify valid variable names from the following

  1. max_price
  2. Total students
  3. US$
  4. student_id
  5. as, for, in, import (reserved words in Python)
  6. discount20
  7. 1st_student

Using Variables

What if you want to change the size of the square from 100 to 50 dots?

Using Variables, extended

Arithmetic Operators


Convert the following mathematical expression to Python expression

Precedence Rules

Exercise on Precedence Rules

Evaluate the following expressions using the operator precedence.

For more details, please contact me here.
Date of last modification: 2021