-
Rules for nameing a Variable.
-
Can't use reverse keywords(e.g. True,for)
-
Can't use special character(e.g. $furit)
-
Variable name must be begin with letter or _ (name = "Shan", cant use 6744 = "number " as variable name)
-
Variable names are case senstive.
There are three numeric types in Python:
- int
- float
- complex
Variables of numeric types are created when you assign a value to them:
- String slicing Index tells us about which charachter is located at whi
- len() function
- in operator
- not in operator
- str does not support item assignment
- replace() function
- dir() function
- upper() and lower() function
- is digit() function
- index() function
- str() function
- \ to escape ' and ""
- multiline string using tripple quotes (''')
- \n and \t characters
- +operator to join two strings
Lists are used to store multiple items in a single variable, lists are one of 4 built-in data types in Python used to store collections of data, the other 3 are Tuple, Set, and Dictionary, all with different qualities and usage. Lists are created using square brackets:
- Access list items using index
- Access list items from reverse using negative index
- Slicing to access multiple list items
- len() function
- in operator to check if element exist in a list or not
- append() function to append the new element in the list
- insert() function to insert element at a given position in the python list
- Add or concate two lists using + operator
- Replace list items using index operator
- Replace multiple list items using slicing
if statement is a programming conditional statement that, if proved true, performs a function or displays information.
- Conditional operators for if
- if..elif..else
- Ternary operator
A for loop is a repetition control structure that allows you to efficiently write a loop that needs to be executed a specific number of times, a for loop is useful when you know how many times a task is to be repeated.
- for loop introduction
- range() function
- break in for loop
- continue keyword
- while loop
- Add function