GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

PYTHON

Sonakshi Godavarthy Englisch

Inhalt der Mindmap

PYTHON

  1. INTRODUCTION

    • Interpreted
    • High-Level
    • General Purpose Programming Langiage
    • Object Oriented
  2. VARIABLES

    • No Command for declaring variable
    • TYPE CASTING
      • <required_datatype>(expression)
        • str(exp)
        • int(exp)
        • float(exp)
    • GET TYPE
      • type(variable/expression)
  3. I/O

    • INPUT
      • Inputs always taken in string
      • input(prompt)
    • OUTPUT
      • Output is also given in string
      • print(statement,sep="exp",end="exp")
  4. CONDITIONAL STATEMENTS

    • if-elif-else
  5. LOOPS

    • for loop
      • for i in range(start,end,inc/dec):
      • for i in list/string:
    • while loop
      • while(condition):
        • else
          • runs else block when condition is no longer true
    • Statements to terminate
      • continue
        • stop current iteration and continue with the next
      • break
        • stops loop even if the condition is true
      • pass
        • if no statements we can write pass
  6. DATA STRUCTURES

    • LIST
      • To store multiple items in a single variable It can store different data types It allows duplicates It is mutable(allows changes) Lists can have lists inside a list
      • list_name=[data1,data2,...]
        • list_name=[]
      • Convertion: list(different data type)
      • Methods
        • sort
          • sorts the list
          • list_name.sort(reverse=True|False, key=myfun)
            • True-&gt;Ascending False-&gt;Descendingmyfun-&gt;returns true according to my own sort
        • append
          • Adds element to end of list
          • list_name.append(element)
            • Element can be string, number, object, variable, etc If the element is iterable like list, set, etc, then it will be added as an element
        • extend
          • Adds iterable to end of list
          • list_name.extend(iterable)
            • iterable can be list, sets, tuple, etc It adds each item as an element
        • insert
          • Adds element at specific position
          • list_name.insert(position,element)
            • Element can be string, number, object , list, etc as an object
        • reverse
          • reverses order of list
          • list_name.reverse()
        • clear
          • removes all elements from list
          • list_name.clear()
        • length
          • returns length
          • x=len(list_name)
        • copy
          • copies specified list
          • x=list_name.copy()
        • count
          • returns number of elements with specified value
          • x=list_name.count(value)
            • value can be string, number, list etc
        • index
          • returns index of first occurrence of specified value
          • x=list_name.index(value)
            • value can be string, number, list etc
        • pop
          • returns and removes the element at specified position default is -1 and return last element
          • x=list_name.pop(position)
        • remove
          • returns and removes the first occurrence of element
          • k=list_name.remove(element)
    • STRING
      • sequence of characters immutable
      • Methods
        • length
          • returns length of string
          • x=len(str_name)
        • capitalize
          • converts the first character to uppercase
          • x=str_name.capitalize()
        • casefold
          • converts string into lowercase
          • x=str_name.casefold()
        • center
          • returns a centered string with delimiter value at both ends
          • x=str_name.center(length,character)
            • length-&gt; required. length of returned string character-&gt;optional.to fill missing space on each side
        • count
          • returns the number of times a specified value occurs in a string
          • x=str_name.count(value,start,end)
            • value-&gt;Required. A String. The string to value to search for start-&gt;Optional. An Integer. The position to start the search. Default is 0end-&gt;Optional. An Integer. The position to end the search. Default is the end of the string
        • encode
          • returns encoded version of a string
          • x=str_name.encode(encoding=encoding,errors=errors)
            • encoding-&gt;Optional. A String specifying the encoding to use. Default is UTF-8 errors-&gt;Optional. A String specifying the error method.
        • endswith
          • returns true if string ends with a specified value
          • x=str_name.endswith(value,start,end)
            • value-&gt;Required. The value to check if the string ends with start-&gt;Optional. An Integer specifying at which position to start the search end-&gt;Optional. An Integer specifying at which position to end the search
        • find
          • Searches the string for a specified value and returns the position of where it was found
          • x=str_name.find(value,start,end
            • value-&gt;Required. The value to search for start-&gt;Optional. Where to start the search. Default is 0 end-&gt;Optional. Where to end the search. Default is to the end of the string
        • index
          • Searches the string for a specified value and returns the position of where it was found
          • x=str_name.index(value,start,end
            • value-&gt;Required. The value to search for start-&gt;Optional. Where to start the search. Default is 0 end-&gt;Optional. Where to end the search. Default is to the end of the string
        • isalnum
          • Returns True if all characters in the string are alphanumeric
          • x=str_name.isalnum()
        • isalpha
          • Returns True if all characters in the string are alphanumeric
          • x=str_name.isalpha()
        • isdecimal
          • Returns True if all characters in the string are decimals
          • x=str_name.isdecimal()
        • isdigit
          • Returns True if all characters in the string are digits
          • x=str_name.isdigit()
        • islower
          • Returns True if all characters in the string are lower case
          • x=str_name.islower()
        • isupper
          • Returns True if all characters in the string are upper case
          • x=str_name.isupper()
        • isnumeric
          • Returns True if all characters in the string are numeric
          • x=str_name.isnumeric()
        • istitle
          • all words first letter should be caps Returns True if the string follows the rules of a title
          • x=str_name.istitle()
        • join
          • Joins the elements of an iterable to the end of the string
          • x=delimeter.join(iterable)
            • delimeter should be string
        • split
          • Splits the string at the specified separator, and returns a list
          • x=str_name.split(delimeter, maxsplit)
            • delimeter-&gt;Optional. Specifies the separator to use when splitting the string. By default any whitespace is a separator maxsplit-&gt;Optional. Specifies how many splits to do. Default value is -1, which is "all occurrences"
        • lower
          • converts string to lower case and returns
          • x=str_name.lower()
        • upper
          • converts string to uppercase and returns
          • x=str_name.upper()
        • title
          • converts string to title and returns
          • x=str_name.title()
        • swapcase
          • returns a string where all cases are interchanged
          • x=str_name.swapcase()
        • startswith
          • returns true if string starts with a specified value
          • x=str_name.startswith(value,start,end)
            • value-&gt;Required. The value to check if the string starts with start-&gt;Optional. An Integer specifying at which position to start the search end-&gt;Optional. An Integer specifying at which position to end the search
        • strip
          • returns string after removing any leading and trailing characters
          • x=str_name.strip(characters)
        • replace
          • replaces a specified phrase with another specified phrase
          • x=str_name.replace(oldval,newval,count)
            • oldvalue-&gt;Required. The string to search for newvalue-&gt;Required. The string to replace the old value with count-&gt;Optional. A number specifying how many occurrences of the old value you want to replace. Default is all occurrences
        • rindex
          • Searches the string for a specified value and returns the last position of where it was found
          • x=str_name.rindex(val,start,enf)
            • value-&gt;Required. The value to search for start-&gt;Optional. Where to start the search. Default is 0 end-&gt;Optional. Where to end the search. Default is to the end of the string
      • str_name="exp"/'exp'
    • TUPLES
      • store items in a single variable ordered and unchangeable ( cannot change, add, remove items) can be homogenous and duplicates allowed
      • tup_name=(data1,data2,..)
        • if tuple has one value we need to add , at end otherwise it is treated as string
        • tup_name=() / tup_name=tuple()
      • Methods
        • length
          • returns length of tuple
          • x=len(tup_name)
        • count
          • returns number of elements with specified value
          • x=tup_name.count(value)
        • index
          • returns index of first occurrence of specified value
          • x=list_name.index(value)
            • value can be string, number, list etc
      • Convertion: tuple(different data type)

Informationen

Beschreibung
Mindmap am PYTHON, erstellt von Sonakshi Godavarthy am 26/05/2021.
Aufrufe
8
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck