This repository is a collection of practical examples presented by Dr. Chuck Severance, illustrating the fundamental concepts and syntax equivalencies between Python and C. The examples provide a comprehensive introduction to the world of C programming while leveraging Python as a bridge for understanding.
Whether you're a newcomer to C programming or looking to solidify your Python skills, this repository offers a hands-on approach to comparing the two languages. Explore the code, experiment, and enhance your proficiency in both Python and C.
Check the full video here
- C is the mother tongue of advanced programming languages
- Python is written in C and deeply influenced by C
Python | C |
---|---|
White space is essential | Whitespace ignored |
Very object-oriented | Not object-oriented at all |
Convenient data structures (list, dict, etc.) | Fast, efficient, powerful (struct, pointers, etc.) |
Auto memory management | Manual memory management |
1980s | 1970s |
-
Arithmetic Operators: + - * / %
-
Comparison Operators: == != < > <= the same
-
Variable naming rules – letter/underscore + numbers/letters/underscores – also case matters
-
While loops – also break and continue in loops
-
Constants similar except for strings and characters and booleans
-
Both have int / float, and char / byte
-
C has no str, list, or dict
-
Python has no struct or double
-
-
Boolean operators
- and / not / or versus && ! ||
-
C for loops are indeterminant (i.e. no for ... in in C)
-
C has no pre-defined True or False
-
None and NULL are similar concepts but quite different
-
Strings and character arrays are similar concepts but very different
-
C has no list, or dict
-
Python has no struct - float in Python is a C double