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

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

expert
Patricia JohnsonNursing
(5/5)

633 Answers

Hire Me
expert
DaniaStatistics
(/5)

861 Answers

Hire Me
expert
Colleen LanclosLaw
(4/5)

629 Answers

Hire Me
expert
Charles BrackenFinance
(5/5)

833 Answers

Hire Me
Python Programming
(5/5)

In this assignment, you will write a custom module using a standard random module and functions.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Intro to Scripting/Python – Assignment 3

In this assignment, you will write a custom module using a standard random module and functions.

Write a module named rand_str.py which imports a random module and has three functions:

Function 1:

• Takes two parameters, a string and a seed value (optional parameter).

• If seed value is passed, use passed value as a seed, if it is not passed, use None as a seed.

• If passed string has only 1 word, return a random character from the string.

• If passed string has two or more words, return a random word from the string.

Function 2:

• Takes two parameters, a string and a seed value (optional parameter).

• If seed value is passed, use passed value as a seed, if it is not passed, use None as a seed.

• If passed string has only 1 word, return the mix of characters.

• If passed string has two or more words, return the mix of words.

Function 3:

• Takes three parameters, two positive integers and a seed value (optional parameter).

• If seed value is passed, use passed value as a seed, if it is not passed, use None as a seed.

• If the first parameter is less than the second parameter, it should return a random integer between first parameter and second parameter.

• If the first parameter is greater than the second parameter, it should return a random integer between second parameter and first parameter.

Write a python file main.py and import the rand_str module. In the main.py, call the functions from rand_str module and print the return values as:

1. Call the function 1 and pass “Python” as string parameter without seed value.

2. Call the function 1 and pass “Python is a scripting language. It provides many standard and third-party libraries.” as string parameter with seed value 42.

3. Call the function 2 and pass “Python is a scripting language. It provides many standard and third-party libraries.” as string parameter without seed value.

4. Call the function 2 and pass “Python” as string parameter with seed value 42.

5. Call the function 3 and, pass 99 and 999 as integers without seed value.

6. Call the function 3 and, pass 999 and 99 as integers with seed value 42.

7. Print the return values of all the function calls.

(5/5)
Attachments:

Expert's Answer

1181 Times Downloaded

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