I just need this assignment done. Doesn't need to be 100% perfect
Microsoft Word - Document1 Python Assignments - 1. Please create a meaningful graph with Python Turtle module. (Draw a picture/image to represent something like a car, house, rainbow, face, etc. But not random shapes) You must use the following turtle functions: forward( ) right( ) or left( ) setheading( ) penup( ) and pendown( ) pensize( ) and pencolor( ) and bgcolor( ) goto( ) begin_fill( ), fillcolor( ), and end_fill( ) -------------------------------------------------------------------------------------------------------- 2. Please write a function called 'square' that has the following signature def square( x, y, width, color ): where x and y: the coordinates of the lower-left corner ( in integers ) width: the width of each side ( in integer, pixal ) color: the fill color ( as a string ) Then write a code to call the function 3 times using different parameters. ------------------------------------------------------------------------------------------------------ 3. Assume a file containing a series of integers is named "numbders.txt" and existson the computer's disk. Write a program that calculates the average of all the numbers stored in the file. Your program must handle the following exceptions: - It should handle any IOError exceptions that are raised when the file is opened, and the data is read from it. - It should handle any ValueError exceptions that are raised when the items that are read from the file are converted to a number. - It should handle ZeroDivisionError exception that is raised when divide by 0. ------------------------------------------------------------------------------------------------------ 4. Write a Python program that lets the user enter the total rainfall for each of 12 months into a list. The program should calculate and display 1. the total rainfall for the year 2. the average monthly rainfall 3. the months with the highest amounts 4. the months with the lowest amounts ------------------------------------------------------------------------------------------------------ 5. Implement a Python class called 'Card' to represent a playing card. Your class should have the following methods: __init__( self, rank, suit ) 'rank' is an integer in the range of 1 to 13 (both inclusive) indicating the ranks from ace to king 'suit' is a single character ("d", "c", "h", or "s") indicating the suit (diamonds, clubs, hearts, or spades). getRank( self ) Returns the 'rank' of the card. getSuit( self ) Returns the 'suit' of the card. value( self ) Returns the Blackjack value of a card. Ace counts as 1, face cards ( J, Q, K ) count as 10. __str__( self ) Returns a string that names the card. For example, "Ace of Spades", "Queen of Hearts", etc. Note: The method __str__ is a special method in Python. It converts an object into a string. When Python is asked to print an object and this method is defined, Python will use this method. For example c = Card( 1, "s" ) print c will print "Ace of Spades" Please also write a Python script to test your 'Card' class. Your testing script should randomly generate an object of 'Card' and print out the card and its associated Blackjack value. A sample output is shown below: Ace of Spades 1 8 of Clubs 8 Queen of Hearts 10 King of Diamonds 10 ....... ------------------------------------------------------------------------------------------------------ 6. Please demonstrate polymorphism using super class 'Shape' and its sub classes 'Square' and 'Circle'. 'Shape' should have attribute 'color' 'Square' should have attribute 'width' 'Circle' should have attribute 'radius' To demonstrate polymorphism, you could define 'calculateArea()' method on both 'Square' and 'Circle' classes ------------------------------------------------------------------------------------------------------ 7. Write a recursive function that accepts an integer argument,n. The function should display n lines of asterisks on the screen, with the first line showing 1 asterisk, the second line showing 2 asterisks, up to the nth line which shows n asterisks. ------------------------------------------------------------------------------------------------------ 8. Please write a Python Program to do the followings: NOTES: You must follow the EXACT INSTRUCTIONS to get the credit; The instructions is in the bottom-up description style: 1. Define a function GetPositiveIntegerList() 1.1. A loop to get a sequence of positive integers from console/user ( Any non-positive integer input to terminate the loop, e.g., 0, null, negative integer, letter, symbols, etc ) ( I will verify it with at least (1)empty input, (2)negative integer, (3) letter ) 1.2. This function should return a Python LIST 2. Define a RECURSIVE function FindMaxRecursion( m, lstIn ) to return the maximum value in the input list 'lstIn' where 'lstIn' is the Python list and 'm' is the current maximum value during the recursive process 2.1. You have to use recursive function to implement it. 2.2. This function should return the maximum value of the 'lstIn' list in the function perameter 3. Define a function called main() 3.1. It has the following skelton: =================================================== def main(): lst = GetPositiveIntegerList(); print( "The input list is", lst ) m = FindMaxRecursion( 0, lst ) print( "The maximum value is", m ) =================================================== 3.2. Please modify the above statement to handle empty list 'lst' and print it as print( "No maximum value due to empty list" ) 4. call main() to test your program. ------------------------------------------------------------------------------------------------------ 9. Create any type of game using everything from above.