<jupyter_start><jupyter_text>Midterm Exam &ndash; DATA 3401 (Fall 2021) Start Date: 10/20 Due Date: 10/22 (at the **end** of the lab period (5:00pm))There will be **no Lab on Friday 10/22** Midterm RulesThis midterm exam is essentially like a short-term lab. Please work the exercises below **on your own**.  When you have completed the exam, you should push your completed jupyter notebook to your GitHub repo for this class in the **Exams->Midterm** folder.You may not discuss the problems with **anyone else**, including persons on an online internet forum. Consulting an outside source like this will be considered an academic integrity violation.You may use all class resources including previous labs and lectures, and anything posted on the course GitHub repo. You may not use any function that trivializes a problem. For example, if I ask you to write a `max` function that computes the maximum entry in a list, you are not allowed to use the pre-defined Python function `max`; you must write your own.  Exercise 11. Write a script or function that asks the user to input 3 numbers, and output the product of the 3 numbers.1. Your code should display an error message if one of the inputs is not a number.1. Test your code on the following inputs:      1. (5, -10, 20.0)    1. (1, "blah", 5)<jupyter_code>## Write your code here
## Test your code here<jupyter_output><empty_output><jupyter_text>Exercise 2Suppose the first element of a sequence is $a_0 = 1$, the second element is $a_1 = 3$, and for every $i>1$, the $i$--th element of the sequence is defined by the recursive relation $a_i = \frac{(a_{i-1}-a_{i-2})^2}{3}$. (So $a_2 = 4/3$)1. Write a function which outputs the $n$--th element of this sequence for a given positive integer $n$2. Test your function for $n = 1, 5, 10, 15,$ and $20$<jupyter_code># Write your function here
# Test your function here<jupyter_output><empty_output><jupyter_text>Exercise 31. Write a function which takes a list as input and outputs the largest **integer** entry. If there is none, return `None`.1. Test your function on the following lists    1. \[ 1, 9, 10.2, 6, -2\]    1. \[1.2, 3/4, "Hello World"\]<jupyter_code># Write your function here
# Test your function here<jupyter_output><empty_output><jupyter_text>Exercise 41. Create a program that will make a deck of cards. Each card should be represented as a tuple of the form `(value, suit)`, where `value` is a number between 2 and 10, Jack, Queen, King, or Ace, and `suit` is one of Spades, Clubs, Diamonds, or Hearts. (So at the end, you should have a list of 52 tuples representing a 52 card deck)1. Create a function that takes in a hand (list) of 5 cards, and determines whether or not the hand is a "flush", meaning that all 5 cards are of the same suit.1. Test your function by inputting the following hands:    1. Ace of Hearts, King of Hearts, Queen of Hearts, Jack of Hearts, 2 of Hearts    1. 2 of Clubs, 3 of Spades, 4 of Clubs, 10 of Diamonds, Jack of Spades<jupyter_code># Write your functions here
# Test your functions here<jupyter_output><empty_output><jupyter_text>Exercise 51. Write a function or script that takes in a string and whose output is the input string minus all of a specified character.  For example, an input of "Hello World" where "l" is removed should result in "Heo Word"1. Test your function by specifying "i" to be removed from "Supercalifragilisticexpialidocious"1. Test your function by specifying "data" to be removed from "data 3401 introduction to python for data science"<jupyter_code># Write your function here
# Test your function here<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup