jweinst1
10/18/2016 - 6:32 AM

more class practice, harder

more class practice, harder

#printing practice

#PingPong class problem
class PingPong:
	
	def PingPong():
		class PingPong:
			
			def __init__(self):
				self.PingPong = "sleeping"
				
				
			def PingPong():
				return PingPong()
				
		return PingPong
		
#Problem 1, what do the following statements print?
a = PingPong.PingPong().PingPong().PingPong
b = PingPong.PingPong()().PingPong
print(a)
print(a == b)

#Classes Problem 2

def Pong(Pong):
	class Ping:
		Ping = Pong
	return Ping

#determine what the following statements print	
c = Pong(2)
print(c().Ping)
print(Pong(4).Ping)