#!/usr/bin/env python # coding: utf-8 # # Practice Problems # ### Lecture 2 # # # Answer each number in a separate cell # # Rename this notebook with your last name, first initial and the (2 digit) lecture number. # # ex. Cych_B_02 # # Turn in this notebook on Canvas. # 1. Conceptual # - Insert a markdown cell into your practice notebook and answer the questions: # - Why are descriptive variable names useful? # - What are _reserved words_ and why can't you use them as variable names? # # 2. Variables # - Insert a code cell into your practice notebook # - In it, define a variable that stores the value of pi (3.1415) # - Define a variable called **radius**, that stores any floating point number (radius) # - Define a string that stores "is the circumference of a circle with radius" # # 3. Operations # - Insert another code cell into your practice notebook. # - Calculate the circumference of a circle using the variables you defined earlier and store the answer in a separate variable. # - print your new variable. # # 4. Changing variable types # - Convert all your variables (**circumference** and **radius**) into strings # - Use the + operator to add them together to make this string: # **circumference** is the circumference of a circle with radius of **radius** # - **boldface** words are your new strings]. # # 5. Strings and string operation # - Define a variable with the value: # "Scripps Institution of Oceanography" # - Print out the first 7 characters # - print indices 8 to 19 # - Print index 23 to the end # # 6. Putting it all together # # - Create an integer variable **depth** and set it to 6 # - Create a string variable **planet** and set it to “Earth” # - convert the variable **depth** into a string # - Create a variable **ocean_depth** and set it to the string: “The average ocean depth on Earth is 6 km” by using the variables depth and planet instead of Earth and 6 # - print out the variable **ocean_depth** # In[ ]: