Oct-21-2016, 02:06 PM
(This post was last modified: Oct-21-2016, 02:36 PM by sparkz_alot.)
Well, you have a lot going on and to be honest, makes very little sense. For instance, in line 45 you have "svar = 0" yet you never use "svar". Line 49 you have "int()" but it relates to nothing. Line 51, you have
You really need to understand the basics. The link posted by metulbuur is very good and there are many, many tutorials out there for beginners.
Here is a very simply example, see if you can follow along with what is happening.
Good luck
if sv == slumpFråga: # if-sats answer = randomquestion print("Correct!")but "sv" will never be comparable to "slumpFraga" because "sv" is a list and "slumpFraga" is a string, so you will always get "False"
You really need to understand the basics. The link posted by metulbuur is very good and there are many, many tutorials out there for beginners.
Here is a very simply example, see if you can follow along with what is happening.
import random question = ["Are you happy", "Are you sad"] choices = ["yes", "no"] rand_question = random.choice(question) print("The question is: ", rand_question) answer = input("What is your answer? ") if answer in choices: print("Your answer is True") else: print("Your answer is False")Start off small and once it works, slowly build up from there. Use variable names that make sense. When you print something, make sure you let yourself and others know what it is your printing. And use "print" statements liberally, to make sure variables contain what they ought to contain and your program is progressing as you intend.
Good luck
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition