View Single Post
Old Aug 14th, 2005, 4:37 PM   #3
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
while he replied i was working on a solution, you need to learn object oriented programming, its a lot funner

class calendarconverter:
	def christiantoislamic(self):
		idate = input("Enter the Christian date:")
		g = idate -579
		if g <0:
			print "The date in the Islamic calendar is" , g - g - g , "BH"
		else:
			print "The date in the Islamic calendar is" , g , "AH"
		
	def islamictochristian(self):
		cdate = input ("Enter the date:")
		print "The date in the Christian calendar is" , cdate + 579 , "AD"
		
	def run(self):
		cal=input("1 or 2:")
		if (cal == 1):
			self.christiantoislamic()
		elif (cal == 2):
			self.islamictochristian()
		else:
			print"Use correct syntax please"
			self.run()
		
calendar = calendarconverter()
calendar.run()
works like a dream
coldDeath is offline   Reply With Quote