Question1:
Create program called reallyrandom.py that has a function that takes in three arguments and prints one integer. Your random seed should be set to 42. The first argument should correspond to the size of a np.randint that has values from 0 to 10.
The second is an integer that you will multiply the randint by.
The third argument is a value you will index the result of the multiplication by. You will print the integer that was indexed as ‘Your random value is x’ where x = the result of the indexing. The program should not crash if the third value is larger than the first. Example:
python3 reallyrandom.py 59 2 7
Should generate the following:
Your random value is 12
Question2:
For this assignment, use the president_heights.csv file found in the Brightspace module. You WILL NOT NEED TO SUBMIT THE FILE TO CODEGRADE Create a program, presidents.py, that takes two arguments. These arguments will correspond to the start and stop of a slice, respectively. It will slice the heights column in the president_heights.csv files.
Then print off the average height, rounded to two decimals, of the selected presidents in the following form:
The average height of presidents number x to y is z
Where:
x = start of the slice y = end of the slice z = calculated average
Question 3:
the sacramento.csv file to complete the following assignment. Create a file, sacramento.py, that loads the .csv file and runs a logistic regression. The regression should predict whether or not a house has 1 or more than one bathroom based on beds, sqft, and price, in that order.
You will need to create a new variable from baths, and it should make it such that those observations of 1 bath correspond to a value of 0, and those with more than 1 bath correspond to a 1. Make sure to add a constant using sm.add_constant(X) Your file should print the results in this way:
print(mod.params.round(2)) print(mod.pvalues.round(2)) print('The smallest p-value is for sqft')


0 comments