Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

== = 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

=+7 How has the COVID-19 pandemic impacted the operations of IHRM?

Answered: 1 week ago