From brand guide: https://flsouthern.mediavalet.com/portals/fsc-brand-guidelines
CSC 2280: Intro Programming
(Fall 2024)

Syllabus

LMS

Teachers

Assignments
Assignments


Other Pages

Project 3:
Programming Conditions are Excellent


Assigned: Mon Sep 09 2024
Due: 11:59:00 PM on Sun Sep 15 2024
Team Size: 1
Language: Python
Out of: 13 points


Now you'll get a chance to use modulus and conditionals in your programming. Enjoy!

Part 0, 1 points: Implement print_minutes_hand, which should work like this:

>>> print_minutes_hand(17)
17 minutes after noon, the big hand is pointing to 17 minutes.
>>> print_minutes_hand(213)
213 minutes after noon, the big hand is pointing to 33 minutes.
Tester.

Part 1, 1 points: Implement print_hours_hand, which should work like this:

>>> print_hours_hand(17)
17 minutes after noon, the little hand is pointing to 0 hours.
>>> print_minutes_hand(213)
213 minutes after noon, the little hand is pointing to 3 hours.
Notice that we say we're pointing to the 0 instead of the 12. Tester.

Part 2, 2 points: From class: print_about_positivity:

>>> print_about_positivity(17)
It is True that 17 is positive.
>>> print_about_positivity(-100)
It is False that -100 is positive.
Remember that for this problem, I don't want you to use conditionals (e.g. if). Tester.

Part 3, 2 points: Write a new function, print_whether_divisible_by_three, which takes a single parameter number and prints a message depending on whether the parameter is divisible by 3. If it is, your function should print

Yes, X is divisible by 3.
otherwise, your code should print
No, X isn't divisible by 3.
(Though use the actual number instead of X.) Tester.

Part 4, 2 points: Write a new function, print_whether_triangle, that takes three parameters and prints whether they could be the lengths of the sides of a triangle. Your code should print one of two responses. For example:

>>> print_whether_triangle(3.0, 5.0, 7.0)
A triangle can have sides of length 3.0 , 5.0 , and 7.0 .
>>> print_whether_triangle(5.0, 1.0, 3.0)
A triangle cannot have sides of length 5.0 , 1.0 , and 3.0 .
Be careful! It shouldn't matter which order the numbers are in!
>>> print_whether_triangle(3.0, 5.0, 4.0)
A triangle can have sides of length 3.0 , 5.0 , and 4.0 .
>>> print_whether_triangle(5.0, 3.0, 4.0)
A triangle can have sides of length 5.0 , 3.0 , and 4.0 .
Degenerate cases should also be allowed:
>>> print_whether_triangle(1.0, 2.0, 3.0)
>>> A triangle can have sides of length 1.0 , 2.0 , and 3.0 .
Those extra spaces might annoy you. If you decide to improve your code to remove any of them, please be sure to remove all of them:
>>> print_whether_triangle(3.0, 5.0, 4.0)
A triangle can have sides of length 3.0, 5.0, and 4.0.
Tester.

Part 5, 2 points: Write a new function, print_whether_right_triangle, that takes three parameters and prints whether they could be the lengths of the sides of a right triangle. Your code should print one of two responses. For example:

>>> print_whether_right_triangle(3.0, 5.0, 4.0)
A right triangle can have sides of length 3.0 , 5.0 , and 4.0 .
>>> print_whether_right_triangle(3.0, 6.0, 4.0)
A right triangle cannot have sides of length 3.0 , 6.0 , and 4.0 .
Be careful! It shouldn't matter which order the numbers are in!
>>> print_whether_right_triangle(3.0, 5.0, 4.0)
A right triangle can have sides of length 3.0 , 5.0 , and 4.0 .
>>> print_whether_right_triangle(5.0, 3.0, 4.0)
A right triangle can have sides of length 5.0 , 3.0 , and 4.0 .
Those extra spaces might annoy you. If you decide to improve your code to remove any of them, please be sure to remove all of them:
>>> print_whether_right_triangle(3.0, 5.0, 4.0)
A right triangle can have sides of length 3.0, 5.0, and 4.0.
Tester.

Part 6, 1 points: Write a new function, print_about_integers, that takes two integer parameters and tells you about how they compare to each other:

>>> print_about_integers(1, 5)
The second number is higher.
>>> print_about_integers(5, 1)
The first number is higher.
>>> print_about_integers(6, 6)
The numbers are equal.
Tester.

Part 7, 2 points: Write a new function, print_about_rectangle, that takes four parameters that are the side lengths of a rectangle. (You should assume these are in order of vertical, horizontal, vertical, horizontal.) The code will return one of three messages based on those numbers, like this:

>>> print_about_rectangle(1, 2, 1, 2)
Nice rectangle.
>>> print_about_rectangle(2, 2, 2, 2)
This is a square!
>>> print_about_rectangle(1, 2, 3, 4)
This isn't a rectangle!
Tester.

Submitting your Project:

Make sure all your code is in a file labelled with your user name (everything before the @ in your school email address) followed by _projects.py all in snake_case. (For example, my file name would be: kburke_projects.py.) It's very important to name your file correctly in order for me to grade it. Make sure your code runs, then upload it to the project on Canvas. (Don't submit code that doesn't run; you won't earn any points!) Your code should include solutions to all non-zero-point problems from Project 0 onwards. If there is already a file up on Canvas, delete that before uploading the new version or make sure your new file replaces that. (Sometimes Canvas adds a number after the file name. Don't worry about that, because it's something (freaking annoying) you don't have control of. I have a script that automatically deletes that.)