homework 1: data types and variables#

Open a new Google Colab document. Make sure your name and “Homework01” is in the title of the document.

Then, complete the following tasks as separate cells/commands within the document, following the same order as the prompts:

  1. Save your first name to a variable called first.

  2. Save your age to a variable called age.

  3. Use “f-string” formatting to run the following line of code: f"my name is {first}, and my age is {age}". For more information on f-strings, see this tutorial on “f-strings” on Digital Ocean.

  4. Save your last name to a variable called last.

  5. Use string concatenatation (when you add one string to another using +) to print your first and last names together.

  6. Add the number 10 to your name variable. This should create an error.

  7. Using a comment, beginning with a #, explain why the above line of code doesn’t work (hint: pay attention to the data types).

  8. Use a string method, like .upper() or .lower(), to change the contents of your first or last name.

When you are finished, download the file as an .ipynb file, and submit the assignment by uploading it to this folder on Google Drive