Question

Create simple python beginners code that outputs a proverb upon request. Find 7 proverbs, wise sayings,...

Create simple python beginners code that outputs a proverb upon request.

Find 7 proverbs, wise sayings, or quotes

Store your proverbs in an if-elif-else decision structure (see below)

Your application should locate the corresponding proverb

Print the proverb and its explanation to the screen, each on a separate line.

Write a “welcome” message that greets the user and explains how the program works

Ask your user to enter a positive integer.

Echo back the user’s choice – for example, “You entered 93”

Use %7 to convert the integer to a number between 0 and 6 (see pages 10 - 12 above and pages 32 - 33 in our text)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#Python program that demonstrates the use of if elif else
#The below python program prompts user to enter
#a choice value and get the remainder value and
#then find the corresponding value and print a message
def main():
    #print a welcome message
    print("Welcome")
    choice=int(input("Enter a positive number :"))
    #Get remainder by dividing by 7
    rem=choice%7
    #Check if remainder value is 0
    if rem==0:
        print("All are not thieves that the dogs bark at. ")
    #Check if remainder value is 1
    elif rem==1:
        print("All's fair in love and war. ")
    #Check if remainder value is 2
    elif rem==2:
        print("All are not friends that speak us fair. ")
    elif rem==3:
    #Check if remainder value is 3
        print("All roads lead to Rome. ")
    elif rem==4:
    #Check if remainder value is 4
        print("All things come to those who wait. ")
    elif rem==5:
    #Check if remainder value is 5
        print("All work and no play makes Jack a dull boy. ")
    #Check if remainder value is 6
    else:
        print("An army marches on its stomach. ")
#calling main method
main()


------------------------------------------------------------------------------------------------

Sample Output:

Welcome
Enter a positive number :25
All things come to those who wait.

Add a comment
Know the answer?
Add Answer to:
Create simple python beginners code that outputs a proverb upon request. Find 7 proverbs, wise sayings,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT