logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Omalaa BatainehNursing
(4/5)

728 Answers

Hire Me
expert
Paul BurlingComputer science
(5/5)

861 Answers

Hire Me
expert
Geoffrey MorrisMathematics
(5/5)

719 Answers

Hire Me
expert
Wil AndersonEngineering
(5/5)

970 Answers

Hire Me
Python Programming
(5/5)

Write Python functions to perform the following. Use appropriate names and validations where necessary

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Exercise 8 : [Marks will be given]

 

Study the given examples and perform the following. Please do not seek any help from others.

 

 

1. Write Python functions to perform the following. Use appropriate names and validations where necessary. (You should not use built-ins or imported functions unless it is unavoidable. Take time to read and understand the question) PToC < = 5 minutes for each

 

i) Receive a number and return its absolute value.

 

ii) Receive a number and return its sign in native form.

 

iii) Receive a lowercase character and return its upper case.

 

iv) Receive a number and return its cube (to the power 3).

 

v) Receive two numbers and return their product.

 

vii) Receive three numbers and return the largest.

 

viii) Receive a two digit number and return the message ‘Mono Digit’ if it is a mono digit number.

 

ix) Receive three numbers and return their average.

 

x) Receive an integer and return the sum of digits.

 

2. Write a program to generate a list of three digit random numbers and use a function to find the difference between the maximum and minimum.

(PToC < = 5 minutes)

 

3. Write a python module called ‘mainMod.py’ which includes two functions ‘addThree()’ and ‘mulThree()’ . The ‘addThree()’ function is to add three integers and ‘mulThree()’ function is to multiply three integers together and return the results.

 

Write the main function as the ‘main()’ to receive three numbers and add them or multiply them depending on the user’s choice as ‘A’ or ‘a’ to add or ‘M’ or ‘m’ to multiply. Display the output of the program an appropriate format.

(PToC < = 5 minutes)

 

4. The Fibonacci sequence F0, F1, F2, … is defined by the following initial conditions and recurrence relation.

 

0 if n = 0

 

Fn = 1 if n = 1

 

Fn-1 + Fn-2 if n >= 2

 

Write a function to generate the Fibonacci sequence called ‘genFibo()’, and use another function called showFibo() to display it as a series of 10 numbers. Write a driver function main() to call those functions as appropriate.

((PToC < = 15 minutes)

 

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme