# data[].attributes.attachment_link.readable_text
from date import Date
class Bank:
	def __init__(self, code, name, location, rank, customers, creationDate):
		self.setCode(code)
		self.setName(name)
		self.setLocation(location)
		self.setRank(rank)
		self.setCustomers(customers)
		self.setCreationDate(creationDate)

	def setCode(self,code):
		self.__code = code
	
	def setRank(self,rank):
		if(rank == 1 or rank == 2 or rank == 3):
			self.__rank = rank
	def setLocation(self,location):
		self.__location = location

	def setCustomers(self,customers):
		self.__customers = customers

	def setName(self, name):
		self.__name = name
	
	def setCreationDate(self, creationDate):
		self.__creationDate = creationDate

	def getCode(self):
		return self.__code

	def getRank(self):
		return self.__rank

	def getLocation(self):
		return self.__location

	def getCode(self):
		return self.__code
	
	def getName(self):
		return self.__name

	def getCustomers(self):
		return self.__customers
	
	def getCreationDate(self):
		return self.__creationDate

def displayInfo(bank):
	print("Code: ", bank.getCode(), "\nName: ",bank.getName(), "\nLocation: ",bank.getLocation(), "\nRank: ",bank.getRank(),"\nCustomers: ",bank.getCustomers())
	bank.getCreationDate().displayInfo()
	print("\n")

def main():
	banks = []
	n = eval(input("How many banks do you want to enter: "))
	for i in range (n):
		code = input("Enter the bank code: ")
		name = input("Enter the bank name: ")
		location = input("Enter the bank location: ")
		rank = eval(input("Enter the bank rank(1, 2, 3): "))
		customers = eval(input("Enter the bank customers: "))
		creationDate = Date (eval(input("Enter the day: ")),eval(input("Enter the month: ")),eval(input("Enter the year: ")))
		bank = Bank(code,name,location,rank,customers,creationDate)		
		banks.append(bank)
		print("\n")
	print("The created banks: ")
	for i in range (len(banks)):
		displayInfo(banks[i])

	print("Banks with rank 1: ")
	for i in range (len(banks)):
		if(banks[i].getRank() == 1):
			displayInfo(banks[i])
	
	print("Banks with customers < 500 ")
	for i in range (len(banks)):
		if(banks[i].getCustomers() < 500):
			displayInfo(banks[i])
	
	print("Code of banks in Beirut ")
	for i in range (len(banks)):
		if(banks[i].getLocation() == "Beirut"):
			print(banks[i].getCode())
	
	print("Ranks of banks created before 1990")
	for i in range (len(banks)):
		if(banks[i].getCreationDate().getYear() < 1990):
			print(banks[i].getRank())

	for i in range (len(banks)):
		if(banks[i].getCode() == "B123"):
			d = Date (eval(input("Enter the day: ")),eval(input("Enter the month: ")),eval(input("Enter the year: ")))
			banks[i].setCreationDate(d)
main()
#################################################################################
class Date:
	def __init__ (self,day,month,year):
		self.setDay(day)
		self.setMonth(month)
		self.setYear(year)

	def setDay(self, day):
		self.__day = day;

	def setMonth(self, month):
		self.__month = month

	def setYear(self, year):
		self.__year = year

	def getDay(self):
		return self.__day
	
	def getMonth(self):
		return self.__month
	
	def getYear(self):
		return self.__year

	def displayInfo(self):
		print (self.getDay(),"/",self.getMonth(),"/",self.getYear())

		
#############################################################################
#############################################################################
##stock
class Stock:
    # Construct a stock object 
    def __init__(self, name, symbol, previousPrice, currentPrice):
        self.__name = name
        self.__symbol = symbol
        self.__previousPrice = previousPrice
        self.__currentPrice = currentPrice

    def getName(self):
        return self.__name 

    def getSymbol(self):
        return self.__symbol

    def getPreviousPrice(self):
        return self.__previousPrice

    def getCurrentPrice(self):
        return self.__currentPrice

    def setPreviousPrice(self,previousPrice):
        self.__previousPrice = previousPrice

    def setCurrentPrice(self, currentPrice):
        self.__currentPrice = currentPrice

    def getChangePercent(self):
        return (self.__currentPrice - self.__previousPrice) * 100 / self.__previousPrice;

def main():

    stock = Stock("Intel", "INTC", 20.5, 20.35)
    print("The price change is " + str(stock.getChangePercent()))
          
main()
############################################################################################
############################################################################################
#fan
SLOW = 1
MEDIUM = 2
FAST = 3

class Fan:
    def __init__(self, speed = SLOW, radius = 5, color = "RED", on = True):
        self.__speed = speed
        self.__radius = radius
        self.__color = color
        self.__on = on

    def getSpeed(self):
        return self.__speed

    def getRadius(self):
        return self.__radius

    def getColor(self):
        return self.__color

    def isOn(self):
        return self.__on

    def setSpeed(self, speed):
        self.__speed = speed

    def setRadius(self, radius):
        self.__radius = radius

    def setColor(self, color):
        self.__color = color

    def setOn(self, on):
        self.__on = on

def displayProperties(fan):
    print("speed", fan.getSpeed(), "\n", "color", fan.getColor(), "\n", 
        "radius", fan.getRadius(), "\n", "fan is on" if fan.isOn() else "fan is off")

def main():
    fan1 = Fan()
    fan1.setSpeed(MEDIUM)
    fan1.setRadius(10)
    fan1.setColor("yellow")
    fan1.setOn(True)
    displayProperties(fan1)

    fan2 = Fan()
    fan2.setSpeed(MEDIUM)
    fan2.setRadius(5)
    fan2.setColor("blue")
    fan2.setOn(False)
    displayProperties(fan2)
          
main()
####################################################################################
####################################################################################
## read numbers as a string from the console
def main():
    s=input("enter numbers:")
    items=s.split() ##extracts items from the string
    numbers =[eval(x) for x in items] ##convert items to numbers
    reverse(numbers)
    print(numbers)

def reverse(list):
    for i in range(len(list)//2):
        list[i],list[len(list)-i-1]=list[len(list)-i-1],list[i]

    return list
main()
################################################################################
################################################################################

# data[].attributes.body
http://pastebin.com/rsaGmE8M

http://pastebin.com/hh5031qU