0

having error

I am haviing error in running a program which is from Ouestion import Question question_prompts = [ 'what color are apple?\n(a)red/green,\n(b)purple,(c)magenta', 'what color are banana?\n(a)blue,\n(b)yellow,\n(c)', 'what color are strawberry?\n(a)red/pink,\n(b)blue,\n(c)green' ] Questions = [ Question(question_prompts[0], "a"), Question(question_prompts[1], "b"), Question(question_prompts[2], "a"), ] def run_test(questions): score = 0 for question in questions: answer = input(question.prompt) if answer == question.answer: score += 1 print("you earned " + str(score) + "/0" + str(len(questions)) + " points") {this is different file} class Question: def __init__(self, prompt, answer): self.answer = answer self.prompt = prompt the output i get is ModuleNotFoundError: No module named 'Ouestion'

17th Dec 2018, 9:41 AM
ojasvi jain
ojasvi jain - avatar
3 Réponses
0
Spelling... Starts with Q...
17th Dec 2018, 10:35 AM
Gordon
Gordon - avatar
0
even after correcting the spelling mistake, the issue is same and i tried it after watching a video which is https://www.youtube.com/watch?v=SgQhwtIoQ7o&list=LL-LxK-0bR4FIlMr2tlQkMjg&index=3&t=535s
18th Dec 2018, 10:05 AM
ojasvi jain
ojasvi jain - avatar
- 1
Did you create the Question module yourself? If so, you need to name the file "Question.py" and save it in the same direction as your main file. Also, I'm not sure if "from Question import Question" will import the class (!) "Question" from the Question.py file. Personally, I would expect "from Question import Question" to look for a function (!) "Question" in the Question.py file. But maybe I'm mistaken...
17th Dec 2018, 12:07 PM
Anna
Anna - avatar