All 39 Python Keywords Explained

108,156
0
Published 2024-04-14
In today’s video we will be learning about all the 39 keywords that exist in Python (as of 3.12). I will be covering each one very briefly, so you will probably have to do your own research if you feel like learning more about these!

▶ Become job-ready with Python:
www.indently.io/

▶ Follow me on Instagram:
www.instagram.com/indentlyreels

00:00 Learning Python made simple
00:05 Intro
01:12 False
01:43 None
02:34 True
03:10 and
04:07 as
05:18 assert
06:49 async
07:24 await
08:35 break
09:05 class
09:30 continue
10:27 indently.io
10:58 def
11:22 del
11:58 elif
12:42 else
12:54 except
13:27 finally
13:49 for
14:10 from
14:34 global
15:31 if
16:04 import
16:28 in
17:05 is
18:18 lambda
19:51 nonlocal
21:05 not
22:18 or
23:15 pass
24:00 raise
24:18 return
25:08 try
26:14 while
27:20 with
28:31 yield
29:34 _
30:50 case
31:24 match
32:28 type
32:58 Soft keywords
33:40 Outro

All Comments (21)
  • @cerealport2726
    I think you're much too harsh on bob at 9:45. bob has helped in so much of my coding. Always been there at the frontlines, takes any assignment I hand out, and successfully completes tasks, or faithfully reports errors encountered. Justice for bob!
  • Thank you I really am beginning to appreciate material that is more focused on thinking, and Python. I’ve learned a lot from tutorials, but for the most part, I am only able to apply what I have copied and limited situation versus having an understanding and being able to create.
  • @verysb
    Some complement: A and B -> (B if A else A) A or B -> (A if A else B) bool(0) -> False bool(“”)-> False bool([])-> False bool(None)-> False bool(“ “)-> True code after else that after while, for, try except will only be executed when the loop or the try is finish normally (not normal: break, error)
  • @ImportCode
    I'm I the only one finding this video funny. Very comprehensive video. I love it.😅
  • Built-in constants: * `False` * `None` * `True` Built-in functions: * `assert` * assert is simply a built-in function that doesn't require parenthesis; you could write your own function, `my_assert`, that does the same thing * `type` * unlike `assert`, you can override `type` Imports: * `import` * `from` - must be followed by `import` * `as` - must be proceeded by `import` or `with` Declarations: * `class` * `def` * `async` - must be followed by `def` * `del` * Scope changes: * `global` * `nonlocal` Logical operators: * Unary: * `not` * Binary: * `and` * `in` * `is` * `or` * Ternary: * `if` and `else` - must be used together, like this: * `(when_true) if (condition) else (when_false)` Expression: * `lambda` * allows you to make a 1-line function that returns the value on the line without declaring the function * very Control: * `pass` * actually does nothing * typically used to put an empty body in a control block, function, or class * Logic * `if` * `else` * `elif` * Loops: * `for` * `while` * `continue` * `break` * Error handling: * `try` * `except` - must be proceeded by `try` * `finally` - must be proceeded by `try` or `except` * `raise` * Functions: * `return` * `yield` * makes the function return a generator, even if the code around `yield` is not accessible * this items in this generator are all of the values of each `yield` statement * if the function hits a `return` statement, the generator will stop / finish and ignore the rest of the function; further attempts to generate items from the generator will fail because it is finished and the GC might have deleted the function call stack that the generator used * Async: * `await` Switch statenements: * `case` * `match` Bad * `with` * `with A as B: C` does this: * run `A` * set `B =` return value of `A` * run `B.__enter__()` * try to run `C` * if an exception occurs, run `B.__exit__(self, exception_type, exception_val, trace)` Doesn't do anything and is not a constant * `_` * essentially not a keyword
  • @cyberhard
    Excellent video. Thanks for sharing your knowledge!
  • @AJMansfield1
    4:07 you also use "as" with "except" to assign the exception to a variable
  • @WinfriedKastner
    Python in 34 minutes. Incredible!! And perfectly explained as always 👍
  • @rakibmasud3288
    Really appreciate your effort. More videos like this please!!!
  • @max_unch
    Thank you for all the excelente work! Great video 👌🏼
  • @Celemimphar
    I have never heard of several of these despite taking a few Python courses... I am intrigued
  • @velo412velo
    Amazing job buddy. Thank you very much for all your hard work! You are amazing and I am defo gonna buy one of your paid tutorials.
  • @PCgmesforever
    Why is it that all programming teachers I know are calmest most chill and nice people yet they casually drop the darkest type of humour or life truths :D
  • @user-co9rc1kp7p
    Amazing video, thx. Waiting for combination of them :) Once, I was really confused by `yield from`
  • You can also use the from keyword to yield from an iterator: yield from iterator
  • @elymX
    Would be nice if you do the same thing for SQL so we can have 1 stop shop as reference.
  • @joshix833
    What about the other uses of else? Like for ... else, while ... else, try ... except ... else?