In Python: The line endings are missing. Usually a gift line ends with a comma (","), but the last one ends with a period (".") , and the next-to-last ends with "and". Write an if-elifelse to add (+) a comma, a period, or and. code: gifts = ['partridge in a pear tree', 'turtle doves', 'french hens', 'colly birds', 'gold rings', 'geese a-laying', 'swans a-swimming', 'maids a-milking', 'ladies dancing', 'lords a-leaping', 'pipers piping', 'drummers drumming'] ordinals = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelvth'] numerals = ['a', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'] #numerals=numerals[0].title() first_verse = 'On the X day of Christmas my true love sent to me' # Your work begins here. # RULES: # 1. Your program must use the variables declared above # 2. Your program may only use these string literals: # "." "," "and" "" # All other strings must be obtained from the variables above. day = 0 while day < 4: # Your code goes in this loop. #print (day+1,numerals[day],ordinals[day]) #print(first_verse.replace('X', ordinals[day])) print(first_verse.replace('X', ordinals[day])) day=day+1 gift_index = day end_index = 0 while gift_index > end_index: print(numerals[gift_index-1],gifts[gift_index-1]) gift_index -= 1
In Python:
The line endings are missing. Usually a gift line ends with a comma (","), but the last one ends with a period (".") , and the next-to-last ends with "and". Write an if-elifelse to add (+) a comma, a period, or and.
code:
gifts = ['partridge in a pear tree',
'turtle doves',
'french hens',
'colly birds',
'gold rings',
'geese a-laying',
'swans a-swimming',
'maids a-milking',
'ladies dancing',
'lords a-leaping',
'pipers piping',
'drummers drumming']
ordinals = ['first', 'second', 'third', 'fourth',
'fifth', 'sixth', 'seventh', 'eighth',
'ninth', 'tenth', 'eleventh', 'twelvth']
numerals = ['a', 'two', 'three', 'four', 'five', 'six', 'seven',
'eight', 'nine', 'ten', 'eleven', 'twelve']
#numerals=numerals[0].title()
first_verse = 'On the X day of Christmas my true love sent to me'
# Your work begins here.
# RULES:
# 1. Your
# 2. Your program may only use these string literals:
# "." "," "and" ""
# All other strings must be obtained from the variables above.
day = 0
while day < 4:
# Your code goes in this loop.
#print (day+1,numerals[day],ordinals[day])
#print(first_verse.replace('X', ordinals[day]))
print(first_verse.replace('X', ordinals[day]))
day=day+1
gift_index = day
end_index = 0
while gift_index > end_index:
print(numerals[gift_index-1],gifts[gift_index-1])
gift_index -= 1
pass
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)