def test_getNumberInWordsUa(self):
     ob = NumToWords.CurrencyToWords("2", "123,56")
     self.assertEqual(ob.getNumberInWords(),
                      "сто двадцять три гривні і п'ятдесят шість копійок")
     ob2 = NumToWords.CurrencyToWords("2", "0,01")
     self.assertEqual(ob2.getNumberInWords(), "одна копійка")
     ob3 = NumToWords.CurrencyToWords("2", "1,00")
     self.assertEqual(ob3.getNumberInWords(), "одна гривня ")
     ob4 = NumToWords.CurrencyToWords("2", "1234567,89")
     self.assertEqual(
         ob4.getNumberInWords(),
         "один мільйон двісті тридцять чотири тисячі п'ятсот шістдесят сім гривень і вісімдесят дев'ять копійок"
     )
 def test_getNumberInWordsEng(self):
     ob = NumToWords.CurrencyToWords("1", "1.00")
     self.assertEqual(ob.getNumberInWords(), "one dollar ")
     ob2 = NumToWords.CurrencyToWords("1", "1234567.89")
     self.assertEqual(
         ob2.getNumberInWords(),
         "one million two hundred thirty-four thousand five hundred sixty-seven dollars and eighty-nine cents"
     )
     ob3 = NumToWords.CurrencyToWords("1", "0.01")
     self.assertEqual(ob3.getNumberInWords(), "one cent")
     ob4 = NumToWords.CurrencyToWords("1", "1234.12")
     self.assertEqual(
         ob4.getNumberInWords(),
         "one thousand two hundred thirty-four dollars and twelve cents")
def song(day):
	if (day>1):
		DaysOfChristmas[1] = 'and ' + DaysOfChristmas[1]
	print "On the %s day of Christmas, my true love sent to me..." % (NumToWords.numToPlace(day))
	while (day>=0):
		print '%s' % (DaysOfChristmas[day])
		day-=1
Exemple #4
0
def calc(num):
	if (num == 4):
		return
	word = NumToWords.numToWords(num)
	newNum = 0
	for letters in word:
		if(letters!=' '):
			newNum += 1
	print '%i = %s (%i)' % (num, word, newNum)
	calc(newNum)
def chooseADay(day): #User specifies day. Prints item of the day.
	print "On the %s day of Christmas, my true love sent to me: %s" % (NumToWords.numToPlace(day), DaysOfChristmas[day])