Quiz game code to learn if and else
Fri Oct 28 2022 12:46:36 GMT+0000 (UTC)
Saved by
@Banndeth
#python
print('Hello, welcome to trivia')
ans = input('Are you ready to play (yes/no)')
score= 0
total_q = 4
if ans.lower() == 'yes':
ans = input('1. What is the best programming language?')
if ans.lower == 'python':
score += 1
print('Correct')
else:
print('Incorrect')
score -= 1
ans = input('2. What is 2 + 8 + 9 -1')
if ans == '18':
score += 1
print('Correct')
else:
print('Incorrect')
score -= 1
ans = input('3. What is better, a 1050ti or a 1060 (graphics card)?')
if ans == '1050ti':
score += 1
print('Correct')
else:
print('Incorrect')
score -= 1
ans = input('4. Who came second in the stanely cup finals?')
if ans == 'nights' or ans.lower == 'vegas':
score += 1
print('Correct')
else:
print('Incorrect')
score -= 1
content_copyCOPY
Comments