import random import string import re def randomString(stringLength=100): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(stringLength)) print ("Shall I compare thee to a summer's day? (William Shaespeare): 1 \nOzzymandias (Percy Bysshe Shelley): 2 \nDeath be not proud (John Donne): 3 \nHow do I love thee? (Elizabeth Barrett Browning): 4 \nLet me not to the marriage of true minds (William Shaespeare): 5") print() choice = int(input("Choose a sonnet (1-5): ")) one = 'Shall I compare thee to a summer’s day? Thou art more lovely and more temperate: Rough winds do shake the darling buds of May, And summer’s lease hath all too short a date Sometime too hot the eye of heaven shines,And often is his gold complexion dimm’d; And every fair from fair sometime declines, By chance or nature’s changing course untrimm’d; But thy eternal summer shall not fade, Nor lose possession of that fair thou ow’st; Nor shall death brag thou wander’st in his shade, When in eternal lines to time thou grow’st: So long as men can breathe or eyes can see, So long lives this, and this gives life to thee.' xone = one.split() two = "I met a traveller from an antique land, Who said—“Two vast and trunkless legs of stone Stand in the desert. . . . Near them, on the sand, Half sunk a shattered visage lies, whose frown, And wrinkled lip, and sneer of cold command, Tell that its sculptor well those passions read Which yet survive, stamped on these lifeless things, The hand that mocked them, and the heart that fed; And on the pedestal, these words appear: “My name is Ozymandias, King of Kings; Look on my Works, ye Mighty, and despair!” Nothing beside remains. Round the decay Of that colossal Wreck, boundless and bare The lone and level sands stretch far away." xtwo = two.split() three = "Death, be not proud, though some have called thee Mighty and dreadful, for thou art not so; For those whom thou think’st thou dost overthrow Die not, poor Death, nor yet canst thou kill me. From rest and sleep, which but thy pictures be, Much pleasure; then from thee much more must flow, And soonest our best men with thee do go, Rest of their bones, and soul’s delivery. Thou art slave to fate, chance, kings, and desperate men, And dost with poison, war, and sickness dwell, And poppy or charms can make us sleep as well And better than thy stroke; why swell’st thou then? One short sleep past, we wake eternally And death shall be no more; Death, thou shalt die." xthree = three.split() four = "How do I love thee? Let me count the ways. I love thee to the depth and breadth and height My soul can reach, when feeling out of sight For the ends of Being and ideal Grace. I love thee to the level of everyday’s Most quiet need, by sun and candlelight. I love thee freely, as men strive for Right; I love thee purely, as they turn from Praise. I love thee with the passion put to use In my old griefs, and with my childhood’s faith. I love thee with a love I seemed to lose With my lost saints,—I love thee with the breath, Smiles, tears, of all my life!—and, if God choose, I shall but love thee better after death." xfour = four.split() five = "Let me not to the marriage of true minds Admit impediments. Love is not love Which alters when it alteration finds, Or bends with the remover to remove: O, no! it is an ever-fixed mark, That looks on tempests and is never shaken; It is the star to every wandering bark, Whose worth’s unknown, although his height be taken. Love’s not Time’s fool, though rosy lips and cheeks Within his bending sickle’s compass come; Love alters not with his brief hours and weeks, But bears it out even to the edge of doom. If this be error and upon me proved, I never writ, nor no man ever loved." xfive = five.split() y=0 if choice == 1: for z in xone: rnd=random.randint(1,100) print(("\033[91m" + xone[y]), "\033[0m", randomString(rnd), " ", end=""), y += 1 elif choice == 2: for z in xtwo: rnd=random.randint(1,100) print(("\033[91m" + xtwo[y]), "\033[0m", randomString(rnd), " ", end=""), y += 1 elif choice == 3: for z in xthree: rnd=random.randint(1,100) print(("\033[91m" + xthree[y]), "\033[0m", randomString(rnd), " ", end=""), y += 1 elif choice == 4: for z in xfour: rnd=random.randint(1,100) print(("\033[91m" + xfour[y]), "\033[0m", randomString(rnd), " ", end=""), y += 1 elif choice == 5: for z in xfive: rnd=random.randint(1,100) print(("\033[91m" + xfive[y]), "\033[0m", randomString(rnd), " ", end=""), y += 1 else: print("invalid input")