More Errors! - Introduction to Python: Absolute Beginner Module 1 Video 13

Publicado em: 24 Julho 2021
no canal de: Book Simplifiers
826
28

Concept: Errors
More Errors!
SyntaxError & NameError
SyntaxError - breaks code formatting rules of python
NameError - object is not defined (can't be found)
Python has a specific grammar that it follows that is referred to as syntax.
The print function syntax rules for output of a single string include

parentheses ( ) containing a string follow print (SyntaxError)
strings have matching quotation marks (SyntaxError)
print is lowercase and correctly spelled (NameError)
Failure to follow any of these rules results in a SyntaxError or NameError when the code is run

Example
SyntaxError

Improperly formatted string (quotes don't match) that results in a SyntaxError
[ ] review and run the code for properly and improperly formatted print statement
print("Hi!")
improper format - non matching quotes
print('I like the morning")
Note that the "prin" misspelling below results in a NameError
[ ] review and run the code
prin('hi')
EOF = "end of file" found in code below
Python went to the end of the file looking for, but not finding, a closing parenthesis
[ ] review and run the code missing the closing parenthesis
print("where are my socks?"
In code below: a parenthesis inside quotations will be seen a part of a string and not as a parenthesis
{ ] review and run the code
print("my socks are in the wrong bin)"
Task 4
Fix Errors
Tip: explaining errors to a partner often reveals a solution (works even if explaining error to a pencil)

[ ] repair the syntax error
print('my socks do not match")


[ ] repair the NameError
pront("my socks match now")


[ ] repair the syntax error
print"Save the notebook frequently")


[ ] repair the NameError
student_name = "Alton"
print(STUDENT_NAME)


[ ] repair the TypeError
total = 3
print(total + " students are signed up for tutoring")


A parenthesis inside quotations will be seen a part of a string and not as a parenthesis


Nesta página do site você pode assistir ao vídeo on-line More Errors! - Introduction to Python: Absolute Beginner Module 1 Video 13 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Book Simplifiers 24 Julho 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 826 vezes e gostou 28 espectadores. Boa visualização!