- Write an adding program that does the following (10 points):
- Ask the user to enter two or more numbers separated by spaces
- Print the sum of all the numbers to the console
- Throw an error if they do not enter at least two numbers or contain a string
- Note: the numbers can be integers or decimals
- Example:
- The user enters: 1 2 3 4
- The program prints: 10
- Write a punishment automation program in Python that does the following (15 points):
- Ask the user to enter a sentence and the of times the sentence should be repeated
- The program should write the sentence (with a line break) the number of times specified by the user to a file called CompletedPunishment.txt
- Example:
- The user enters this for the sentence: I will not sleep in class
- The user enters this for the number of repeats: 100
- The program should write I will not sleep in class 100 times to CompletedPunishment.txt.
- Write a word count program in Python that does the following (25 points):
- Prompt the user to enter a word
- Parse PythonSummary.txt and count the number of times the word occurs in the file
- Tell the user how many times the word occurs
- Note: It should find the word regardless of case (upper or lower) or punctuation
- Example:
- The user enters: python
- The program should print: The word python occurs 13 times
- Write a class schedule formatting program that does the following (25 points):
- Parses classesInput.txt for the following info (on the corresponding line):
Line 0: Number of courses (the following data should exist for each course)
Line 1: Course department
Line 2: Course number
Line 3: Course name
Line 4: Credits
Line 5: Lecture days
Line 6: Start time of the lecture
Line 7: End time of the lecture
Line 8: Average grade (percentage) for the course
- Outputs a file with the data formatted as follows:
COURSE 1: <Course department><Course number>:<Course name>
Number of Credits: <Credits>
Days of Lectures: <Lecture days>
Lecture Time: <Start time> <End time>
Stat: on average, students get <average grade> in this course
REPEAT for each additional class, up to <Number of courses>
Reviews
There are no reviews yet.