M
M
Matthew Stafford2018-10-17 21:55:26
Python
Matthew Stafford, 2018-10-17 21:55:26

New words are not entered into a text document, how to fix it?

For some reason, the word is entered into the text document only starting from the second input, what could be the problem and how to fix it?

.
                fest = open("est.txt", "a")
                feng = open("eng.txt", "a")
                while True:
                    word1 = input("Sisestage sõna eesti keeles: ")
                    word2 = input("Sisestage seda sõna inglise keeles: ")
                    if word1 != "" or word2 != "" or word1 != "" and word2 != "":
                        word1 = word1.lower()
                        word2 = word2.lower()
                        fest.write(word1 + "\n")
                        fest.write(word2 + "\n")
                        print("Uued sõnad on lisanud mängule ( EST: " + word1 + ") | ENG: " + word2 +" )")
                    else:
                        fest.close()
                        feng.close()
                        print("Viga sõnades!")
                        break

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Matthew Stafford, 2018-10-17
@matthewstafford

.
             while True:
                    fest = open("est.txt", "a")
                    feng = open("eng.txt", "a")
                    word1 = input("Sisestage sõna eesti keeles: ")
                    word2 = input("Sisestage seda sõna inglise keeles: ")
                    if word1 != "" or word2 != "" or word1 != "" and word2 != "":
                        word1 = word1.lower()
                        word2 = word2.lower()
                        fest.write(word1 + "\n")
                        feng.write(word2 + "\n")
                        print("Uued sõnad on lisanud mängule ( EST: " + word1 + ") | ENG: " + word2 +" )")
                    else:
                        fest.close()
                        feng.close()
                        print("Viga sõnades!")
                        break

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question