Are you interested in learning Python?
A thread on Python's basic syntax
P/S: If you liked this thread, please retweet.
A thread on Python's basic syntax

P/S: If you liked this thread, please retweet.
VARIABLES
- Variable names are case sensitive (name and NAME are
different variables)
- Must start with a letter or an underscore
- Can have numbers but must not start with one
- Python is loosely-typed (you don’t specify the type when
declaring a variable.
- Variable names are case sensitive (name and NAME are
different variables)
- Must start with a letter or an underscore
- Can have numbers but must not start with one
- Python is loosely-typed (you don’t specify the type when
declaring a variable.
FUNCTIONS
- In python, functions are defined with the def keyword.
- Indentation is used instead of curly braces.
- A colon is placed after the parameters.
- No semi-colons.
- In python, functions are defined with the def keyword.
- Indentation is used instead of curly braces.
- A colon is placed after the parameters.
- No semi-colons.
STRINGS
- Strings in python are surrounded by either single or double quotation marks
- F-Strings enable you easily concatenate two different types without having to cast it first
- Strings in python are surrounded by either single or double quotation marks
- F-Strings enable you easily concatenate two different types without having to cast it first
DICTIONARY
- These are data collections which are unordered, changeable and indexed. Similar syntax to objects in Javascript.
- These are data collections which are unordered, changeable and indexed. Similar syntax to objects in Javascript.
LOOPS
- Loops are mechanisms for iterating over a list of items while performing a consistent action on each of them
- Loops are mechanisms for iterating over a list of items while performing a consistent action on each of them
CONDITIONALS
- If/else expressions are used to execute a set of instructions based on whether a statement is true or false.
- If/else expressions are used to execute a set of instructions based on whether a statement is true or false.
MODULES
- A module is a file containing a set of functions to include in your application. There are core python modules which are part of the Python environment, modules you can install using the pip package manager as well as custom modules
- A module is a file containing a set of functions to include in your application. There are core python modules which are part of the Python environment, modules you can install using the pip package manager as well as custom modules
CLASSES.
A class is like a blueprint for creating objects. An object has properties and methods associated with it.
- Like with functions, all fields inside a class must be indented.
- Use def keyword to define a method
- self keyword is used to refer to the current class.
A class is like a blueprint for creating objects. An object has properties and methods associated with it.
- Like with functions, all fields inside a class must be indented.
- Use def keyword to define a method
- self keyword is used to refer to the current class.
To learn more, read the full article: https://dev.to/ubahthebuilder/learn-all-about-python-s-syntax-in-6-minutes-fgb