Question: == = QUESTIONS 2 (30 MARKS): (a) Convert the following non-Python expressions into Python expressions: 10.5y * 2z y+20.5 w is evenly divisible by 7


== = QUESTIONS 2 (30 MARKS): (a) Convert the following non-Python expressions into Python expressions: 10.5y * 2z y+20.5 w is evenly divisible by 7 (2 marks) (b) Determine the value of each of the following expressions when typed interactively at Python console: (i) (31 40) or (80= 25)) (2 marks (c) Predict output of the following program: weights [40, 80, 100, 150, 200] print (weights [1:2]) print (weights (-3]) print ( [weight*0.5 for weight in weights]). count 0 unit ='Engineering Graphics' for letter in unit: if letter in 'aeiou': count= count+1 print (count) density {'Water': 1000} density['Air'] = 1.2 print (density) (5 m (d) Provide an appropriate specification (i.e. what does the function do?) for the function below. Assume that arg is a string def f(lowest, highest): from random import random gen_nums = 0 for i in range (10): gen_nums.append(round (lowest + return gen_nums (highest-lowest) *random(), 2))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
