-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfavoritewordsaver.py
65 lines (47 loc) · 2.26 KB
/
favoritewordsaver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
wordList = []
def registerWord():
if os.path.exists("favoriteWords.txt"):
wordFile = open("favoriteWords.txt", "a")
else:
wordFile = open("favoriteWords.txt", "w")
wordAddLoop = "Yes"
wordDefinitionLoop = "Yes"
count = 0
while wordAddLoop == "Yes" or wordAddLoop == "yes" or wordAddLoop == "y":
wordNew = input("What is your new favorite/interestring word(s) of the day? ")
wordFile.write(wordNew + "\n")
wordDefinitionAmount = int(input("How many definitions does this word have? "))
for x in range(wordDefinitionAmount):
wordSpeechType = input("noun / pronoun / verb / adjective / adverb / preposition / conjunction / interjection ? ") ### adjective, noun, etc
wordDefinition = input("Definition of the word? ") ### definitnio of the word
count += 1
wordFile.write(wordSpeechType + "\n")
wordFile.write(str(count) + ". " + wordDefinition + "\n")
#while wordDefinitionLoop == "Yes":
# wordDefinitionLoop = input("Is there another definition to the word? (Yes/No) ")
# if wordDefinitionLoop == "Yes":
# wordSpeechTypeMulti = input("Alternative speech type of the word? ")
# wordDefinitionMulti = input("Alternative definition of the word? ")
wordFile.write("\n")
count = 0
wordAddLoop = input("Would you like to add another word? (Yes/No) ")
wordFile.close()
return [wordNew, wordSpeechType, wordDefinition]
def main():
registerWord()
### openFIlewrite
#### if open Filewrite exists, write to the same file
#### Word Template
#### 'Word' - (Speech Type)
#### Definition
#### 1st deifnition
#### 2nd definition
#### Acessed whatever date
### store word in a list 1 x 3, [word, speech type, definition]; 0 is head, -1 is tail always within another array, the 2nd array is always speech type, the middle are always other deifnitions
### a oop to ask if there is another definition
### if so, ask the quesiton, store thi deifinitino in its proper array position
### if not move on in sequences
### a loop to ask if you want to enter qanother word.
### ask to end program, y/n, force quit if press something
main()