Answered step by step
Verified Expert Solution
Question
1 Approved Answer
== = 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started