Next topic

This Page

Quick search

Submit these to owl before the deadline. Put them in separate functions in a single .py file.

EXAM DAY AND TIME:

DEC 19th, 2017:

7pm-10pm

EXAM LOCATIONS:

HSB 13

HSB 14

MC 235

Details on which room you are in will be released shortly.

DURING THE EXAM...

You must use a lab computer and you must not talk to one another. You may use the google, or any other website to complete the questions (however, you’re not allowed to upload solutions at an early date, and then download/copy them during the practical). Be warned that the lab computers will monitored during this time.

The lab computers use Microsoft Windows, so I recommend visiting these labs at an early date to familiarize yourself with the environment if you’re not already comfortable with Windows. You are only allowed to use the ipython interpreter and Notepad++ (no IDEs are allowed).

You are not allowed to go to the TAs or me for help with these questions!

The program will continuously prompt the user to enter the name of the item purchased, then prompt for the price of the item, and lastly ask for the quantity. This process will repeat until the user types “CHK” in capital letters.

After “CHK” is typed, the program will ask for the tax rate.

The program will display a formatted table like the example displayed below.

NOTES:

The program should work for an arbitrary large number of items

Assume he doesn’t only buy carrots

Your program must show exactly 2 decimal places when printing the bill

Your program must round properly

Formatting is important!

However, don’t worry about having the columns aligned up perfectly based on digit placement (ex, tax row within the totals column)

Write a function to encript a string by exchanging letters with a letter some fixed number of positions down the alphabet. The below example shows what the alphabet would be encripted to with an offset of 3. This function must take a string and an offset.

abcdefghijklmnopqrstuvwxyz

defghijklmnopqrstuvwxyzabc

WARNING. THIS IS NOT JUST A STRING ROTATION

So with the cipher, if we had the string “hello world”, it would turn into “khoor zruog”.

Write a function to de-ecript a string by doing the opposite of the first function, effectively undoing the encryption. This function must take a string and an offset as parameters.

NOTES:

Feel free to create helper functions

It is possible to write 1 function to do both, however, you don’t have to

Write a program which will plot At Bats (AB) vs. On Base Percentage (OBP) for all players in both leagues who had more than 100 at bats. Additionally, the radius of each data point in the graph should be equal to that player’s Home Run (HR) count. Lastly, the data points should be coloured based on the league; all American League data points should be blue and all National League data points should be red.

Make sure that your axis are also labeled properly with a title matching the figure below.

NOTES:

MLB is weird, their percentages are not actually percentages, they’re decimal values. So just plot yours like the figure below with the percentages as decimal values

What’s cool about this plot is that 4 dimensions are being represented: AB, OBP, HR, and League!

Size of plot does not matter (like if yours is short and fat vs. square).

Write a program to check if a string is a palindrome. Your program should read the file one line at a time and check if it is a palindrome. Your program should also ignore case, ignore spaces, and ignore any punctuation at the end of the strings. See the below example.

NOTES:

Must print out the original string

Must work for an arbitrary file

Must eliminate spaces

Must eliminate punctuation at the end of the strings

Must ignore the case (upper case vs. lower case)

The strings must be printed out with quotations like in the below example