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/artistbio.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
28 lines (21 sloc)
1.24 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 main(): | |
singers = input("""Please choose one of theese singers/bands to know more about them: | |
\n Dua Lipa\n Ariana Grande\n Little Mix\n Miley Cyrus\n Tatum Rosner\n Pop Smoke\n Justin Bieber\nEnter your choice: """) | |
result = "No such singer" # create variable where if user enters the singers who is not on the list gives them "no such singer" | |
with open("Singers.txt", "r") as file: | |
for line in file: # to search the database in every single line | |
if singers.lower() in line.lower(): # if statement to see if the singer is in the line | |
result = line # if it is then output it if not say "no such singer" | |
break # to stop the loop | |
print(result) | |
good_answer = ['Yes', 'yes', 'Ok', 'ok', 'Go ahead', 'go ahead', 'Fine', 'fine', 'Please', 'please'] | |
while input("Would you like to know more about the other artists?: ") in good_answer: | |
singers = input("Tell me the artists name: ") | |
with open("Singers.txt", "r") as file: | |
for line in file: | |
if singers.lower() in line.lower(): | |
result = line | |
break | |
print(result) | |
else: | |
print("Have a good day!") |