Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
musicbot/preferences.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
46 lines (38 sloc)
1.42 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pref(): | |
with open("fav_song.txt", "a") as file: | |
user_choice = input("Enter your favorite song: ") | |
file.write("\n") | |
file.write(user_choice) | |
file.close() | |
with open("fav_genre.txt", "a") as file: | |
music_preference = input ("Tell me your favorite music genre: ") | |
file.write("\n") | |
file.write(music_preference) | |
file.close() | |
pref() | |
def answers(): | |
user_choice = ['Yes', 'yes', 'Ok', 'ok', 'Go ahead', 'go ahead', 'Fine', 'fine', 'Please', 'please'] | |
user_choice = input("would you like to know which favorite songs you entered before?: ") | |
with open("fav_song.txt", "r") as file: | |
for line in file: | |
if user_choice in line: | |
result = line | |
break | |
if user_choice == user_choice: | |
file = open('fav_song.txt', 'r') | |
print(file.read()) | |
file.close() | |
answers() | |
def answers2(): | |
good_answer = ['Yes', 'yes', 'Ok', 'ok', 'Go ahead', 'go ahead', 'Fine', 'fine', 'Please', 'please'] | |
user_choice = input("would you like to know which favorite genres you entered before?: ") | |
with open("fav_genre.txt", "r") as file: | |
for line in file: | |
if user_choice in line: | |
result = line | |
break | |
if user_choice == user_choice: | |
file = open('fav_genre.txt', 'r') | |
print(file.read()) | |
file.close() | |
answers2() |