Numeric Data and Operators

  1. Numeric Data

    Question 1 of 4

      Create two variables num_1 as 7, num_2 as 3.5 and:
      1. Display their data types
      2. Display their sum
      3. Display their difference
      4. Display their product
      5. Display their division
      6. Convert both num_1 and num_2 into string and display sum again
    • Repeat above exercise but with storing both variables with a complex number
    • Create variable num_3 as 15 and num_4 as 4. Swap their values and display the result
  2. Assignment Operators

    Question 2 of 4

    • Assign mark_1, mark_2, mark_3 with value 78, 85, 92. Calculate total and average mark
    • Assign weight_1, weight_2, weight_3, weight_4 all having value as 70
      1. Add 5 to weight_1 and reassign to weight_1
      2. Subtract 10 from weight_2 and reassign to weight_2
      3. Multiply weight_3 by 1.1 and reassign to weight_3
      4. Divide weight_4 by 2 and reassign to weight_4
    • Assign variable my_num as 15. Find remainder when divided by 2 as reassign to itself
    • Find the value when 1.1 is raised to the power of 3 i.e. 1.1 ^ 3. Assign is to result
  3. Comparison & Logical Operators

    Question 3 of 4

      Assign your age to variable my_age and:
      1. Check if your age 16
      2. Check if your age is not 70
      3. Check if you are a child (age less than 13)
      4. Check if you are an adult (age 20 or above)
      5. Check if you are eligible to vote (18+ can vote)
      6. Check if you are a teenager (age between 13 and 19)
      7. Check if you lie on passive population (below 5 and over 65 considered passive)
      8. Check if you are eligible for driving license (age between 18 and 65)
  4. Membership Operators

    Question 4 of 4

      Assign variable my_name as your name and check if:
      1. Letter a is in your name
      2. Letter a is not in your name
      Assign variable movie_collection as a list of your favorite movies and check if:
      1. Movie Avatar is in your collection
      2. Movie Avatar is not in your collection
    • Repeat exercise 2 but creating movie_collection as a tuple
    • Repeat exercise 2 but creating movie_collection as a set