Learn Python 3 The Hard Way - Exercise 49: Making Sentences

preview_player
Показать описание

Chapters:
0:00 Introduction
8:07 Code walkthrough
22:05 Using the parser
36:15 Testing our code
48:42 Study drills
54:15 Common student questions
Рекомендации по теме
Комментарии
Автор

Hey, thanks for the vid. I'm doing this exercise as well and I stumbled upon an attribute error (solved it btw here's how but first some explanation->) Problem of attribute error appeared from nowhere. I was doing just fine and imported both modules - parser and lexicon. When I started testing I got attribute error: NameError: name 'match' is not defined
I thought that there was a typo and checked everything. But the problem persisted even when I started copying names of functions (methods) from parser file just in case my eyes got blurry. First checked lexicon and it worked just fine as well as its functions (methods) and I checked it specifically.
I went to google the problem and it turned out that in 2024 python has its own parser in-built module! So be careful there! I believe it wasnt a thing 2 years ago but now it's a big deal! Because of the in-built parser module python doesnt import your module in ex48 folder, it instead imports in-built parser so it doesn't let you test your code!
If you want nosetests to run properly do this: rename parser.py into something different. Like ex49_parser.py or my_parser.py and retest your code. It should start working after that

Unbearableweightofwisdom
Автор

Hi!
Why are you testing skip function (43:36) on a single word, and not on a tuple?

Esli_b_mog_to_spizdil
Автор

I am having trouble with this particular problem on the ex. I'm getting the error:
File "<stdin>", line 1
x = parse_sentence([('verb', 'run'), ('direction', 'north')])
^
Syntax Error: invalidSyntax

evansdarien
Автор

Hello sir. I would like to ask if i could get the copy of your code for the ex49? Coz im a newbie here, hehe. Thank you so much with that sir.

jfGAGO
Автор

thanks so much for the vids! For this ex. I'm getting the error:
File "<stdin>", line 1
x = parse_sentence([('verb', 'run'), ('direction', 'north)])
^
SyntaxError: EOL while scanning string literal


do you know how to fix this?

anisawashington
Автор

In the Python interpreter .. Its showing me , Module not found Error .. What should I do now !

starlord