Individual Homework 1 File to submit to T-Square: HW01.py any others for the turtle drawing like a background image This is an INDIVIDUAL assignment! Collaboration at a reasonable level will not result in substantially similar code. Students may only collaborate with fellow students currently taking CS 2316, the TA's and the lecturer. Collaboration means talking through problems, assisting with debugging, explaining a concept, etc. You should not exchange code or write code for others. For Help: - Piazza (but do not post code!) - Collaborate with others in the class, but do not exchange code! Notes: - Don't forget to include the required comments and collaboration statement (as outlined in the syllabus) - Don't wait until the last minute. Coding takes time and is usually filled with unexpected issues. Quality of code: Be sure to give yourself enough time so that even once you have code that works, rethink and refine your code to make it more elegant, more efficient, etc. Rarely is the first design the best design. Also be sure to write small amounts of code and test it before adding more. You'll end up with fewer and less complicated issues to fix if you embrace step-wise refinement. 1. Imagine there is no built-in function to swapcase within the string class. Write your own swap case function that works like this: >>> swapcase("Hello") 'hELLO' >>> swapcase("Good Bye!") 'gOOD bYE!' Note that case swapping should only effect alphabetic letters. Try to write fairly elegant code that resorts to using ord() and chr() if and when it must. Useful operations to keep in mind include the in operator, comparison operators between strings, += operator to concatenate. 2. Write a program called drawTravelAbroad that uses a turtle or turtles to draw something that is related to your travel abroad experience so far. The function has no parameters and no return value. It's result will be a turtle world depicting a scene. Be sure the scene you draw includes the following: a) at least three different objects b) at least one geometric shape c) at least five colors (the default background color and default pen color count) d) at least two different line thicknesses e) optionally you can set your background to a color or image Your code should include a call to exitonclick() so that the display window will exit if you click on it once finished looking at it. References: https://docs.python.org/3.1/library/turtle.html http://openbookproject.net/thinkcs/python/english3e/hello_little_turtles.html 3. Write a recursive function that takes text as a parameter and then judges whether or not the text represents a palindrome. To make the judging a bit more flexible, you should not differentiate between upper and lowercase letters. An example is the name Bob. Bob will be judged to be a palindrome. Name the function isPalidrome. Have it return a Boolean based on whether or not the text is a palindrome. Remember, your code must be recursive. Do not use a for loop, a while loop, nor any reversing trick. 4. Write a program called turtleClock that uses the turtle module to draw a clock set to a given hour position. turtleClock(9) draws a clock whose hands are set to 9:00. turtleCock(5) draws a clock whose hands are set to 5:00. See image provided with this assignment on the homework web page. The function is to be named turtleClock having one integer parameter - the hour the clock is to be set. Bonus if you can write a more sophisticated version which includes the hour and the minutes. This will be tricky since the minute hand will effect where exactly the hour hand must point. For example: turtleClock(9, 30) draws a clock whose hands are set to 9:30. turtleCock(5, 15) draws a clock whose hands are set to 5:15. In this version, the function is to be named turtleClock, but it will have two integer parameters. One for the hour and one for the minutes. Requirements: you must use looping to help draw the 12 hour marks for the clock. See example similar to this: http://openbookproject.net/thinkcs/python/english3e/hello_little_turtles.html 5. Write a function called pricePerGallon that takes a price in euros for a liter of fuel as a parameter and then returns the equivalent price per gallon. (Almost exactly as was done in class if you got to this problem! Be sure to read the error checking part below.) Use these facts: 1 US gallon = 3.78541178 liters 1 euro = $1.128215 Error checking: if the parameter is not of type int or float, return the phrase "Sorry this function requires a numeric argument". 6. Make up another homework problem, and write the solution for it. Treat this question seriously. Your question and answer should not be too trivial nor too hard.