dimanche 9 juin 2019

if-else statements not working in for-loop in python

iterated list through for loop in python and print each element of list and have put if-statements in that for loop

ques=[" Is the song the lead single for the album 'The Most Beautiful Moment In Life Pt.1'?","Is the song  from the album 'The Most Beautiful Moment In Life Pt. 1?"," Is the song you're guessing from the old works of BTS ? "," Is the song the debut song of BTS ?"," Is the song from the album '2 Cool 4 Skool' ?"," Is the song the first song to has a new music video for the Japanese version ?"]

INU=[" Is the song the lead single for the album 'The Most Beautiful Moment In Life Pt.1'?","Is the song from the album 'The Most Beautiful Moment In Life Pt. 1?"," Is the song you're guessing from the old works of BTS ? "] NMD=[" Is the song you're guessing from the old works of BTS ? "," Is the song the debut song of BTS ?"," Is the song from the album '2 Cool 4 Skool' ?"," Is the song the first song to has a new music video for the Japanese version ?"] inu=0 nmd=0 for i in ques: print('\n') print(i) ch=input("\nyes or no-") for j in ques: if j in INU and ch=='yes': inu+=1 if inu==3: print('The song is I NEED YOU')
break
for k in ques: if k in NMD and ch=='yes': nmd+=1 if nmd==4: print('The song is NO MORE DREAM') break

i expect the output of the elif statements(in for loop) to print no more dream but it isn't giving any output

Aucun commentaire:

Enregistrer un commentaire