Skip to article frontmatterSkip to article content

Exercise 3 - Primitive Data Types

5 total points

Directions

  • Due: 9/21/2025 @ 11:59 p.m.
  • Change the name of your notebook to EX3_FirstLast.ipynb, where First is your first name and Last is your last name.
  • For each of the following prompts, write or modify Python code that fulfills the requirements.

Important information to remember

  • Periodically, you should click File -> Save Notebook
  • When you are done working for the day, click File -> Log Out
  • When you are finished, download the notebook and upload it to the submission link
  • I will reset the notebook and run each code block on its own. You will receive half credit if you rely on a variable from a previous or subsequent code block.

Setting variables to primitive data types

Each problem should be answered with one line of code unless otherwise specified.

Problem 1

Set a variable named a to an int (0.5 pts)

Problem 2

Set a variable named b to a float (0.5 pts)

Problem 3

Set a variable named c to a bool (0.5 pts)

Problem 4

This answer requires three lines of code

4.1 - Set a variable named d1 to an int (0.15 pts)

4.2 - Set a variable named d2 to an int (0.15 pts)

4.3 - Set a variable named d to a float using only d1 and d2 (0.2 pts)

Problem 5

This answer requires three lines of code

5.1 - Set a variable named e1 to an int (0.15 pts)

5.2 - Set a variable named e2 to a float (0.15 pts)

5.3 - Set a variable named e to a float using only e1 and e2 (0.2 pts)

Problem 6

This answer requires three lines of code

6.1 - Set a variable named f1 to a float (0.15 pts)

6.2 - Set a variable named f2 to a float (0.15 pts)

6.3 - Set a variable named f to a bool using only f1 and f2 (0.2 pts)

Problem 7

This answer requires three lines of code

7.1 - Set a variable named g1 to an int (0.15 pts)

7.2 - Set a variable named g2 to an int (0.15 pts)

7.3 - Set a variable named g to a bool using only g1 and g2 (0.2 pts)

Problem 8

This answer requires three lines of code

8.1 - Set a variable named h1 to a int (0.15 pts)

8.2 - Set a variable named h2 to a float (0.15 pts)

8.3 - Set a variable named h to a bool using only h1 and h2 (0.2 pts)

Problem 9

This answer requires three lines of code

9.1 - Set a variable named i1 to the result of a bitwise operator test (0.15 pts)

9.2 - Set a variable named i2 to the result of a bitwise operator test (0.15 pts)

9.3 - Set a variable named i to a bool using the result of an “OR” bitwise operator test using i1 and i2 (0.2 pts)

Problem 10

This answer requires three lines of code

10.1 - Set a variable named j1 to the result of a bitwise operator test (0.15 pts)

10.2 - Set a variable named j2 to the result of a bitwise operator test (0.15 pts)

10.3 - Set a variable named j to a bool using the result of an “AND” bitwise operator test using j1 and j2 (0.2 pts)