Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hi, I need 3 programs written, can this be done for 3 gigs ($15)?
- To begin, all programs should have the following form:
- #! /usr/bin/env python3
- # Name
- # Date
- # Description
- import libraries here
- def yourFunction(param):
- return value
- def main():
- program goes here
- if __name__ == '__main__':
- main()
- (Just leave the name/date/description etc blank ill fill that in)
- Program 1:
- Write a program which prompts the user for two sentences, and then prints out whichever sentence is shorter (by number of characters).
- Should end up like this:
- lab07$ shorterSentence.py
- Sentence 1: This is a short sentence.
- Sentence 2: This is a very very very very long sentence.
- This is a short sentence.
- Program 2:
- Write a program which prompts the user to enter a phrase, and then prints that sentence back out with all of the vowels (a, e, i, o, and u) turned into capital letters, and all other letters turned into lower-case letters.
- lab07$ capitalVowels.py
- Phrase: The quick brown fox JUMPS over the lazy dog
- thE qUIck brOwn fOx jUmps OvEr thE lAzy dOg
- Program 3:
- SUNY Plattsburgh determines a student's class level (whether the student is considered a Freshman, a Sophomore, a Junior, or a Senior) by the number of credits that student has earned toward their graduation.
- Credits Level
- 1-27 Freshman
- 28-56 Sophomore
- 57-84 Junior
- 85+ Senior
- Write a program which reads in a list of usernames and credits earned from a file, and prints out a list of the Freshmen, the Sophomores, the Juniors, and the Seniors.
- For example, given the following data file:
- "tstud001 17
- tstud002 68
- jsmit001 57
- bjoe001 97
- asmit001 72"
- The program would generate the following output:
- lab07$ byClass.py
- Input file: students.txt
- FRESHMEN
- tstud001
- SOPHOMORES
- JUNIORS
- tstud002
- jsmit001
- asmit001
- SENIORS
- bjoe001
- __
- Please don't print the header of any group which has no students in it. So, for example, the above output would not display the "SOPHOMORES" header.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement