Write a function that will take a grade between 0 - 100 and have it
ifthe grade is < 50 or ‘PASS’ otherwise.
Write some code to take
inputfor a grade between 0 - 100. Store this in some variable.
Call the function we wrote and give it the inputted value.
Run this code a few times for fun. See if you can break it.
Let’s change our function a little. Make it so it can
returnthe letter grade (0 - 50 -> F, 50 - 60 -> D, 60 - 70 -> C, 70 - 80 -> B, 80 - 90 -> A, 90 - 100 -> A+).
Do you know what to expect when you run your code again? Run your code. Did it do what you expected?
If this scares you, go back and look at the lecture notes. All the info you need is in there. BUT, if you really do get stuck, ASK FOR HELP! Ask someone next to you, ask a TA, ask me.
Remember, here is the magic code we needed last week:
data = input() # Read a WHOLE, SINGLE line of input data = data.split() # Split string into individual pieces aVar = int(data) # Take string from data[X], convert it to int... bVar = int(data) # ... And store it in some variable
The above will only work for certain situations, so you will need to hack this to make it work for specific cases!!!!!!!!!!!!!
https://open.kattis.com/problems/twostones (Slow down and THINK)
https://open.kattis.com/problems/spavanac (kinda’ tricky)
https://open.kattis.com/problems/cetvrta (kinda’ annoying)
https://open.kattis.com/problems/bus (seems like a sequence again… can we figure this one out on our own?)
ENSURE WE HAVE RECORDED YOUR COMPLETION. FAILURE TO DO SO WILL RESULT IN A GRADE OF 0!
If you are in the online section, you must submit the .py (python scripts), not the .ipynb (notebook files). To get the python scripts from Colab, simply select File and in te dropdown menue, hit Download .py.