Problem Set 2¶
Problem 2.1
Write a Python program which functions as a “simple” calculator. The calculator should be able to add
two numbers, subtract
two numbers, multiply
, divide
, and evaluate exponents
(i.e. 10 ^ 5).
Problem 2.2
Write a Python function called hail
that takes an integer as its argument. If the integer is even, return the value of the integer multiplied by 2. If it’s odd, return the value of the integer multiplied by 3 and with 1 added. That is: n
goes to 2*n
if even, 3*n+1
if odd. HINT: You may want to look up the Python modulus operator: %
.
Problem 2.3
Write a Python function which reads a csv file into a dataframe, then saves that dataframe as a new csv file (with a different name).