Write a python program that allow the user to reads contents

Assignment Help Data Structure & Algorithms
Reference no: EM131230558

Assignment

Design an algorithm and use it to write a Python program that allow the user to reads the contents of the data file into a list

Task

In the Resources section of the Interact2 subject website there is a data file called students.txt. This file contains student details: a valid student number, course (BIT or MIT) and the specialisation (ex: software design and development). Each student number is an eight digit number such as 11556677. (Note: Two records in the file have intentionally been "corrupted" - for testing purposes.)

Design an algorithm and use it to write a Python program that allow the user to reads the contents of the data file into a list. The program should then loop, to allow a user to check various numbers against those stored in the list. The loop should terminate when an "empty" input occurs - i.e. when the user presses the [Enter] key on its own. (Obviously this last entry should NOT be checked against the list!) If the student number input matches an element somewhere in the list, the program should display the number together with the course and the specialisation. If the number input does not match any element in the list, then the program should display the number and a message saying that it IS NOT a valid student number.

Notes: The algorithm should be written in pseudocode (structured English).

The records read from the data file should be checked and NOT placed into the list if they are something other than an 8 digits. (Display a sensible message if the file is found to have corrupt records in it.)

The numbers entered by the user should be checked to ensure they are valid digits (as distinct from valid student numbers) and not processed further if they are not.

Your programs should use one or more functions where sensible, and be documented fully.

Use exceptions where necessary.

Specify 3 sets of test data that will demonstrate the correct ‘normal' operation of your program. Show your test data in a table as you have done in earlier assignments.

Run your program using the test data you have selected and save the output produced in a single text file.

Submit:

1. Your algorithm and test data table.

2. The table recording your chosen test data.

3. Source code for your Python implementation.

4. Output test file demonstrating the results of using the test data.

5. Contents of the data file cars.txt read by the program.

It is important that the output listings are not edited in any way.

Rationale

Reinforce topic material related to files and exceptions.

Reinforce topic material related to lists.

Reference no: EM131230558

Questions Cloud

Plans for employee-security training : Discuss the importance of having plans for employee-security training. Provide specific examples of how training can result in a higher level of enterprise security.
Identification of the field location for data collection : Explain the Objective of the study and Identification of the field location for data collection - Out the three theory classes, one theory class shall be exclusive allocated for Course Work discussion/ Field data collection and instructions.
Write description of an effective leader : In your own words, write a description of an effective leader. List and explain five qualities that you believe are found in effective leaders. (Try to choose qualities that have not already been described.)
What current flows through the bulb : Is it possible for two people to simultaneously operate 850 W hair dryers on the same 120 V circuit without tripping a 15 A circuit breaker? Yes or no? Explain each dryer draws 8.50, 7.1, 3.5, or 4.7A of current, so two such devices will, will n..
Write a python program that allow the user to reads contents : Design an algorithm and use it to write a Python program that allow the user to reads the contents of the data file into a list.
Explain how to test weak form efficiency in the stock market : Explain the difference between weak-form, semistrong-form, and strong-form efficiency. - Explain how to test weak-form efficiency in the stock market.
The stock market is weak form efficient : Market Efficiency: - Consequently, the consulting firm concluded that the stock market is weak-form efficient. Do you agree? Explain.
Supply chain responsiveness and supply uncertainty : Explains the following terms and, where relevant, how they related. Implied demand uncertainty, Supply uncertainty, Implied uncertainty, Supply chain responsiveness.
The stock market is weak form efficient : Market Efficiency: - Consequently, the consulting firm concluded that the stock market is weak-form efficient. Do you agree? Explain.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  How many passes through the data will be made

How many passes through the data will be made by the selection sort for N data items and How many numbers are placed in order on each pass through the data (each iteration of the inner loop) for the selection sort?

  Write essay on djkistrars algorithm

Write Essay on Djkistrars Algorithm

  Differences between array and linked list implementation

Discuss the differences between the array implementation and the linked list implementation of queues. List the advantages and disadvantages of each implementation.

  What numbers are compared to 72 if a sequential search is

question 1. what numbers are compared to 72 if a sequential search is used 2 5 7 9 11 17 18 21 28 30 45 5465 69 72.

  Explain advantages of eager decision tree algorithm

Explain advantages and disadvantages of new algorithm compared with eager decision tree algorithm, and advantages and disadvantages of new algorithm compared with lazy kNN algorithm.

  Multilayer protocol in the sense of the osi reference model

The president of company A decides that company A should work with company B to develop a new product. The president tells her legal department to look into the idea, and they in turn ask the engineering department for help.

  Using command line options in bash shell script

Design a script that will permit the user to enter one of several choices from the command line. The specific requirements are as follows:

  Function to swap all the left-right subtrees of binary tree

Write a function, swapSubTrees, that swaps all of the left and right subtrees of a binary tree. write a method singleParent, that returns the number of nodes in a binary tree that have only one child.

  How long do es a value take to transit the entire pipeline

Construct a pipeline that connects an arbitrary number of goroutines with channels. What is the maximum number of pipeline stages you can create without running out of memory? How long do es a value take to transit the entire pipeline?

  State two different self-reductions for the sum problem

State two different self-reductions for the SUM problem and give recursive algorithms based on your divide-and-conquer self-reductions to solve the SUM problem.

  Create an idef1x entity relationships diagram

The Metropolitan Housing Agency is a non profit corporation that advocates the development and improvement of low income housing.

  Generates all the possible n-node binary tree

Implement a function that generates all the possible N-node binary tree configurations. The value N is a parameter to the function and the function should return a list of binary tree. Any container ADT (list, queue, vector, etc...) will be used t..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd