1 class Person: 2 department = 'School of Information' #a class variable 3 4 def set_name(self, new_name): #a method 5 self.name = new_name 6 def set_location(self, new_location): 7 self.location = new_location
1 person = Person() 2 person.set_name('Christopher Brooks') 3 person.set_location('Ann Arbor, MI, USA') 4 print('{} live in {} and works in the department {}'.format(person.name, person.location, person.department))
Christopher Brooks live in Ann Arbor, MI, USA and works in the department School of Information
1 store1 = [10.00, 11.00, 12.34, 2.34] 2 store2 = [9.00, 11.10, 12.34, 2.01] 3 cheapest = map(min, store1, store2) 4 cheapest
<map at 0x7f8eeefd4fd0>
1 for item in cheapest: 2 print(item)
9.0 11.0 12.34 2.01