Question: Write a python program that will randomly generate a fortune for its user based on their age. The fortune teller asks for their age, anyone

Write a python program that will randomly generate a fortune for its user based on their age. The fortune teller asks for their age, anyone under 21 gets a PG fortune and anyone over 21 gets a PG-21 fortune. The program works as follows: each fortune consists of 4 sentences, with a fixed grammatical structure. Therefore, it is easy to randomly replace any of the 4 sentences and still create a grammatically correct story. The 4 sentences have the following structure:

Sentence 1: Creates a subject (person or thing)

Sentence 2: Describes the subject

Sentence 3: Predicts an action by the subject

Sentence 4: Offers the user some advice

An example fortune might read like this:

If the fortune seeker is under 21:

Sentence 1: A friend from school

Sentence 2: Who speaks with a lisp

Sentence 3: Wants to friend you on Facebook

Sentence 4: Better run the other way!

If the fortune seeker is over 21:

Sentence 1: A man from France

Sentence 2: With a bald head

Sentence 3: Seeks your hand in marriage

Sentence 4: Beware of wolves in sheeps clothing!

besides the main() function, your program should create four functions, sentence1(), sentence2(), sentence3() and sentence4(), that each print its part of the fortune. main() simply calls these four functions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!