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()
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
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
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme