My code always goes to the else function and I don't know why
mainattempt = 0
import random
from random import randint
number_even = (random.randint(0,21)) * 2
quotesfile=open("Songs.txt")
lines=quotesfile.read().splitlines()
import random
print("Welcome to my music qiuz")
while mainattempt < 2: #haven't done the attempt yet disregard that
a = list(lines[number_even])
a1 = list(lines[number_even + 1])
print(a[0])
print(a1[0])
a = (a)
a1 = (a1)
print(lines[number_even]) # just prints the name so i can check it already
print(lines[number_even + 1])
artist = input("Artist:")
song = input("Song:")
if (artist) == (a): # suppose to check if what the user inputted is the same as the name in the text file
if (song) == (a1):
print("Correct, you move on in the game")
else:
print("You have one more attempt") # always just posts this
The Text file:
Michael Jackson
Billie Jean
Logic
Flexicution
Eminem
Mocking brid
Ed Sheeran
Lego house
Ski mask the slump god
Cash me outside
Lil pump
Gucci gang
Drake
God's Plan
Ariana Grande
7 rings
Jaden Smith
Icon
Lil Nas X
Old town road
Post Malone
Rockstar
21 Savage
Bank Account
A Boogie with a hoodie
Drowning
6ix9ine
Gummo
Ynw Melly
Murdeer on my mind
Ybn Nahmir
Bounce out with that
Blueface
Respect mt crippin
George Ezra
Budapest
Kodak Black
ZEZE
Juice World
Lucid Dreams
Cardi B
I like it
Stormzy
Vossi bop
spaced on different lines
Aucun commentaire:
Enregistrer un commentaire