Skip to content

Commit 94daaf2

Browse files
author
ephrimlawrence
committed
Random Sentence Generator and Note Writer!!
1 parent 3c7045b commit 94daaf2

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

random-sentences.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
verb = ["drove", "jumped", "ran", "walked", "skipped"]
1616
preposition = ["to", "from", "over", "under", "on"]
1717

18-
for x in range(20):
18+
19+
def random_sentence():
20+
"""Creates random and return sentences."""
21+
1922
sentence = ""
2023
sentence += article[random.randint(0, 4)] + " " + noun[random.randint(
2124
0, 4)] + " "
@@ -24,21 +27,20 @@
2427
sentence += article[random.randint(0, 4)] + " " + noun[random.randint(
2528
0, 4)] + ". "
2629
sentence = sentence[0].upper() + sentence[1:]
27-
print(sentence)
30+
31+
return sentence
32+
33+
34+
# prints random sentences
35+
for x in range(20):
36+
print(random_sentence())
2837

2938
print()
3039
print()
3140

3241
# short story part
3342
story = ""
3443
for x in range(20):
35-
sentence = ""
36-
sentence += article[random.randint(0, 4)] + " " + noun[random.randint(
37-
0, 4)] + " "
38-
sentence += verb[random.randint(0, 4)] + " " + preposition[random.randint(
39-
0, 4)] + " "
40-
sentence += article[random.randint(0, 4)] + " " + noun[random.randint(
41-
0, 4)] + ". "
42-
story += sentence[0].upper() + sentence[1:]
44+
story += random_sentence()
4345

4446
print(story)

0 commit comments

Comments
 (0)