Problem 1: Using only list indexing and the string function split()
, write code that extracts the weight (here the number 7) from the string data
defined below, and print out the result. What is the type of your final result? Use python to find out.
data_string = "height: 15; weight: 7; width: 5;"
Problem 2: Using only string indexing, write code that does each of the following. In each case, store the result in a new variable and print its contents.
data_string
.data_string
.data_string
and combine them into a single, new string that should look like this: "abcdefghijklmnopqrstuvwxyz0123456789"data_string
(the lower-case e) with a captial X. Do not use the function replace()
.data_string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"