Question: Question 4: a) Write a python program to take two lists as input from user. The lists are named as cat_1 and cat_2. The lists

Question 4: a) Write a python program to take two lists as input from user. The lists are named as cat_1 and cat_2. The lists contain the daily weights of two cats over a period of ten days. Write statements to do the following: (10 Marks) i. If the weight of cat_1 is greater than that of cat_2 on day 1, print" cat_1 weighed more than cat_2 on Day 1.'; otherwise, print" cat_1 weighed less than cat_2 on Day 1" ii. If cat_1 weighed more than cat_2 on day 1 and if cat_1 weighs more than cat_2 on the last day, print " cat_1 remained heavier than cat_2."; otherwise, print " cat_2 became heavier than cat_1." iii. If your solution to the previous question used nested if statements, then do it without nesting, or vice versa. b) Consider the expression given below. This formula is used to compute the approximate value of 1/1. Write a function named approx_pi (), that uses this formula to compute and returns an approximate value in python] (10 Marks) (Hint: You need to import math module for computing square root. Compute factorial using another user defined function of factorial. Use a while loop to compute the summation, loop uns until the absolute value in summation becomes less than 1e-15) 1 = 2v2 (4k)!(1103 + 26390k) 9801 k=0 7T (k!)43964k
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
