Q create a time or point or rectangle or another

This preview shows page 4 - 8 out of 9 pages.

Q:Create a Time or Point or Rectangle or Another class and provide methods as listed below: i.Constructor; __init__ ii.String conversion; __str__ iii.Etc…Q/A:Given the class Time below: class Time: def __init__(self, hours = 0, minutes = 0, seconds = 0) : self.hours = hours self.minutes = minutes self.seconds = seconds def __str__(self):
5
Answer the following questions: i.Create an object for this class. ii.Use the appropriate method to set the data attributes to the following time: 14 hours, 45 minutes and 00 seconds. iii.Create a method called printTime() that prints the output of time in the format hours/minutes/seconds. Use the print statement on the object to produce output of the time. iv.In the box below, show the output for your program that you have created in steps { i, ii, iii }. Show your output here : SHORT ANSWERS QUESTIONS 1. Assign a value to var so that the string ’Got it!’ is printed out: var = _______________________
…)
6print (’Got it!) else: print (’Almost’) 2. What is(are) the ouput(s)? 3. Modules/methods 4. Local variables, scope, break, continue 5. Format Operator ‘%’7. Variable Trace & Random Numbers PROGRAMMING QUESTIONS 1. Write a Python function to do …3. Strings, Lists, tuples, text files 4. Recursion Review the examples that we have seen in class and also in Quizzes questions 5. OOP questions 6. Finding pattern in a string Etc…ESSAY QUESTIONS 1. What is the definition of class, object, attribute, method, invocation, indentation, constructor, etc…2. Explain the difference between the …./ What is the difference between the
7

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture