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
Hardik DixitSociology
(5/5)

783 Answers

Hire Me
expert
Vikrant BansalComputer science
(5/5)

835 Answers

Hire Me
expert
Sean WoodComputer science
(5/5)

556 Answers

Hire Me
expert
Patricia JohnsonNursing
(5/5)

570 Answers

Hire Me
Python Programming
(5/5)

Make your own module and define a function in the module, then import the module and call the function in a python program.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

38

Make your own module and define a function in the module, then import the module and call the function in a python program.

The module name is myModuleand the function name is hellothat simply displays

"hello".

39

Make a python program that convert Fahrenheit to Celsius given a list of float values in Fahrenheit using numpy package(Package is a set of modules).

Once you run the program, the program displays a list of values (at least 10) in Fahrenheit and then displays converted numpy array in Celsius.

40

● Make a Python program that displays a main menu and sub-menus using while loop, if-else, and menu functions.

● menu module has multiple functions that displays different menus such as main menu, utility menu, game menu, and multimedia menu. These functions do not have any input argument and return value but only display options for the user to select.

● The program imports menu module to use the menu functions

● Once the program starts, it shows the main menu, then if the user select one of options, the program shows the submenu the user selected.

● The program repeatedly display the menu and sub-menus until the user selects the option to exit or return from the current submenu to the main menu.

● Example of the program’s input and output is as follows. (next slide)

File Handling

The key function for working with files in Python is the open()function. The open()function takes two parameters; filename, and mode.

There are four different methods (modes) for opening a file:

"r"-Read -Default value. Opens a file for reading, error if the file does not exist "a"-Append -Opens a file for appending, creates the file if it does not exist "w"-Write -Opens a file for writing, creates the file if it does not exist

"x"-Create -Creates the specified file, returns an error if the file exists

Open a file and Write on the file

The open()function returns a file object, which has a write()method for writing a content of the file.

For example,

f = open("test.txt", "a")

f.write("Hello, Dr. Kim!") f.close()

(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