Mindmap
Python
Inhalt der Mindmap
Python
string-built in functions
- variable.upper()
- variable.lower()
- variable.capitalize()
- len(variable)
- show the caracter long of a string[for exampl: 'python' has 6 caracter long]
- ord(variable)
- the output of this function is the unicode value of a string
- chr(variable)
- show in the consol the string wich has the unicode value detected
- type(variable)
Data types
- text
- str 'the text'
- Numeric
- int[integer numbers]
- float[decimal numbes]
- Complex[complex numbers]
- Saquence
- tuple(Uchangeable collection)
- the basecs tuple built-in functions are the same as list exept wich who can modifie the elements
- min()|max()|sum()|index()|count()|sorted()
- the basecs tuple built-in functions are the same as list exept wich who can modifie the elements
- set{Don't store similar Data,its elements are unordered}
- the basecs set built-in functions are
- add() 'to add elements'|discard()'to remove an element wich we don't know if it's present or not'|update()'to add the elmenets of alist to another list'|
- the basecs set built-in functions are
- LIst[collection]
- To extract an index from a list use : List name[index number]
- To change an index in a list use : list name[index number]="the new index"
- to extract a sub-list from a list use: list name[start index:end index]
- to pack tow lists in one list (separated by [])use: pack name=[list1,list2]
- to unpackyow lists(make their indexs in one list)use: pack name=[*list1,*list2]
- tuple(Uchangeable collection)
- Boolean
- True
- False
- bool(condition using the mathimatical operators)
- Exampl : bool(3 ==4)
- the output is False
- Exampl : bool(3 ==4)
- text
Numeric functions
- round(a float variable)
- return the float number with a specify number of decimal numbers
- max(variable1, vairable2)
- return the maximum number between tow numbers or more
- divmod(variable1,variable2)
- return the quotion of the division of tow numbers
- pow(variable, the power)
- abs(variable)
- return the absolute value of a number
- min(variable1, variable2)
- return the minimum number between tow numbers or more
- round(a float variable)
List built-in functions
- list name.index(the index number)
- output the element wich represent the index detected
- lisr name.clear()
- remove all the elements of a list(clear a list)
- del(list name[index number]
- The same as pop function
- list name.pop(index number)
- remove an element using its index number
- list name.Sort()
- order the list elements ascendingly
- list name.append(the element)
- add a element to a list
- list name.count(the element)
- return the number of occurences of an element
- list name.remove(the element)
- remove an element from a list
- list name.reserve()
- order the list elements desendingly
- list name.index(the index number)
dictionary
- caracterized by a key and its value (dt={'key':'value'})
- dictionary built-in fuctions are: dict.fromkeys(key,value):to creat a dictionary|pop()|clear()|update()|
- caracterized by a key and its value (dt={'key':'value'})
loops
- While loop:
- while means that we tell the program to run a code while the given condition stays true,and stop it when it turn to false
- To avoide the infiniti loops we should add the incramentation like (i+=1) it means that after every loop we add 1 to 'i'
- The while loop syntax is : "while condition: code"
- For loop
- While loop:
Functions
- def Function_Name (Argument Or Keyword_Argument='parameter'):
- to execute the function we need to call it using its name
- Arguments
- informations that we pass in the function as arguments(the values given in the calling of the function are ordered the same way as the arguments given in the function
- Arbitrary arguments
- *args: we use it whene we don't know the number of arguments
- Keyword arguments
- they are arguments with values we write: Keyword_Argument=Value
- Arbitrary keyword argumens
- **kwargs: we use it whene we don't know the number of keywod arguments
- if we had a function with a simpl syntax we can define it using:
- variable= lambda arguments:code
- def Function_Name (Argument Or Keyword_Argument='parameter'):
Informationen
- Beschreibung
- Mindmap am Python, erstellt von Briache Issam am 06/07/2021.
- Erstellt von
- Briache Issam
- Aufrufe
- 3
- Bewertung