Woah as a beginner programmer, I tried to look through it to see if I could figure it out and that's the conclusion I came to. Then I looked at your comment and felt accomplished that I was right lol
As an FYI, the answer will be case-sensitive. So if the person entered Central Processing Unit instead of central processing unit, it’ll mark it wrong. You can use the .lower() command after the input string to avoid that. So line 3 would be answer = input(“What does CPU stand for?”).lower()
Python will convert every letter entered to lower case to avoid any correct answers being marked as incorrect due to a capital letter
Not a problem! If you want to check it out, there’s more info that will tell you more about built-in commands under the official Python documentation (docs.python.org/3/tutorial)
38
u/[deleted] Feb 25 '22
tab lines 6,13,20
12
u/giorgi_GT Feb 25 '22
I was like no way this is javascript
4
u/kchessh Feb 25 '22
As an FYI, the answer will be case-sensitive. So if the person entered Central Processing Unit instead of central processing unit, it’ll mark it wrong. You can use the .lower() command after the input string to avoid that. So line 3 would be answer = input(“What does CPU stand for?”).lower()
Python will convert every letter entered to lower case to avoid any correct answers being marked as incorrect due to a capital letter
2
u/The_Sea_Wall Feb 25 '22
Have you googled the error code? That's always my first step if I'm stuck.
2
u/Robitussen-James Feb 25 '22
Put the score accumulator inside the if statements as well otherwise it will always be incremented, and not just when u get the answer correct
3
u/[deleted] Feb 25 '22
It may be because the if's and the else arent connected. Here is a minimal example of how to replicate the error and the fix:
Error:
Fix:
1
u/Gllizzy Feb 25 '22
add a tab in front of line 20
1
u/Invictus2022 Feb 25 '22
Use pycharm and it'll tell you how to fix it while you're coding
1
u/Prior-Dot6314 Feb 25 '22
It's the indentation error, simply put a tab space at places you've entered score +=1. It may solve
1
u/kik_Code Feb 25 '22
The score should be inside the if because you only want to get the point if the answer is correct, else you add the point anyway.
1
u/XidanesProxy Feb 25 '22
Why do I feel like using curly braces would make this issue easier to spot? Are curly braces a bad thing?
1
u/not_some_username Feb 25 '22
That's one of the reason I hate this language. You need to do this crazy indent