hw06.py - passphrase ='CC74EB def survey(p You do not need to understand this code > survey(passphrase' import hashlib return

hw06.py - passphrase ='CC74EB def survey(p You do not need...

This preview shows page 1 - 2 out of 2 pages.

passphrase = 'CC74EB' def survey(p): """ You do not need to understand this code. >>> survey(passphrase) '3d2eea56786a3d9e503a4c07dd667867ef3d92bfccd68b2aa0900ead' """ import hashlib return hashlib.sha224(p.encode('utf-8')).hexdigest() # Object Oriented Programming class Fib(): """A Fibonacci number. >>> start = Fib() >>> start Fib object, value 0 >>> start.next() Fib object, value 1 >>> start.next().next() Fib object, value 1 >>> start.next().next().next() Fib object, value 2 >>> start.next().next().next().next() Fib object, value 3 >>> start.next().next().next().next().next() Fib object, value 5 >>> start.next().next().next().next().next().next() Fib object, value 8 >>> start.next().next().next().next().next().next() # Ensure start isn't changed Fib object, value 8 """ def __init__(self,value=0 ): self.value = value def next(self): if self.value == 0: answer = Fib(1) if self.value != 0: answer = Fib(self.value + self.prev) answer.prev = self.value return answer def __repr__(self): return "Fib object, value " + str(self.value) class VendingMachine: """A vending machine that vends some product for some price.
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Spring '14

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors