• Home
  • About
  • Posts
  • 1. Built-in functions

  • 2. Built-in functions2

    • 2.1. del
    • 2.2. print
    • 2.3. enumerate(iterable, start=0)
    • 2.4. map(function, iterable)
    • 2.5. filter(function, iterable)
    • 2.6. zip(*iterable)
    • 2.7. lambda paramter: function

Appendix 01. Python Built-in Functions

📅 2022-11-08
🖋️ Byongho96
  • 1. Built-in functions
  • 2. Built-in functions2
    • 2.1. del
    • 2.2. print
    • 2.3. enumerate(iterable, start=0)
    • 2.4. map(function, iterable)
    • 2.5. filter(function, iterable)
    • 2.6. zip(*iterable)
    • 2.7. lambda paramter: function

1. Built-in functions

Function description input output change
dir() show all the varibales and functions(mehtods) in the object object list;['variables', fucntions] X
id() return the memory address object int X
len() return the number of imtes in container container int X
min() return the minimum of an iterable data iterable object X
max() return the maximum of an iterable data iterable object X
ord() return the unicode poinit chr int X
sum() return the sum of an iterable data iterable int X
type() return the type of object object type X

2. Built-in functions2

2.1. del

  • delete object

    del obj_name
    
  • delete (items in list) or (key in dict)

    del my_list[0]
    del my_dict['name']
    

2.2. print

  • formating

    print('%d %f', %(200, 3.4))
    print('{:d} {:f}' .format(200, 3.4))
    print(f'{200:d} {3.4:f}')
    
  • conversion specifier

    specifier conversion
    %d, :d decimal
    %o, :o octal
    %x, :x hexadecimal_lower
    %X, :X hexadecimal_upper
    %f, :f float
    %c, :c character
    %s, :s string
  • conversion specifier applications

    specifier conversion
    %10d, %5f, %20s
    %>10d, %>5f, %>20s
    width of the field
    right aligned
    %010d, %05f, %020s width of the field
    right aligned
    fill left with 0
    %-10d, %-5f, %-20s
    %<10d, %<5f, %<20s
    width of the field
    left aligned
    %^10d, %^5f, %^20s width of the field
    center aligned
    %.2f, %5.2f width of the field
    decimal place of the float
    %.3s, %10.2s width of the field
    num of printed chr from the left

2.3. enumerate(iterable, start=0)

return iterable elements paired with int that start with 'start' parameter

  • return enumerbate object
  • tuples are in the object

2.4. map(function, iterable)

apply the function to all the elements of iterable object * return map object

2.5. filter(function, iterable)

apply the function to all the elments of iterable object, and remain elemetns which are ture * return filter object

2.6. zip(*iterable)

pair elements in different iterable object according to its index number

  • when the len of iterable objects are different >> take short as a standard
  • return zip object

2.7. lambda paramter: function

used for defining a simple function

이전 포스트

05. Python Error Handling

다음 포스트

Appendix 02. Python Modules

작성자 프로필
전체 글 (127)
  • Animation
    • Backend
      • Django
      • Spring
    • DevOps
      • AWS
      • CI&CD
      • Docker
      • Git
      • Gunicorn
      • Kubernetes
      • Nginx
    • Frontend
      • Gatsby
      • React
      • Vue
    • Knowledge
      • .etc
      • Algorithm
      • Data Structure
      • Database
      • Design Pattern
      • Interview
      • Network
      • Web
    • Language
      • CSS
      • HTML
      • Java
      • JavaScript
      • Linux
      • Python

    Copyright © 2023 Byongho96  & Powered by Gatsby