Python - PowerPoint PPT Presentation

About This Presentation
Title:

Python

Description:

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also available under the GNU General Public License (GPL). – PowerPoint PPT presentation

Number of Views:22
Slides: 13
Provided by: GreensTechno

less

Transcript and Presenter's Notes

Title: Python


1
PYTHON BUILT IN FUNCTIONS
  • Abs()-Returns the absolute value of a number
  • For Example, x  abs(-7.25)
  • All()-Returns True if all items in an iterable
    object are true
  • For Example, mylist True,
    True, Truex  all(mylist)
  • Bin()-Returns the binary version of a number
  • For Example, x  bin(36)
  • Bool()-Returns the boolean value of the specified
    object
  • For Example, x  bool(1)

2
  • Compile()-Returns the specified source as an
    object, ready to be executed
  • For Example, mytext
     'print(55)' x
     compile('mytext', 'test', 'eval')
    exec(x)
  • Complex()-Returns a complex number
  • For Example, x
     complex(3, 5)
  • Dict()-Returns a dictionary 
  • For Example, x  dict(name
     "John", age  36, country  "Norway")

3
  • Dir()- Returns a list of the specified object's
    properties and methods
  • For Example, class Person  name
     "John"  age  36  country  "Norway"print(di
    r(Person))
  • Eval()-Evaluates and executes an expression
  • For Example, x  'print(55)
  • eval(x)

4
  • Exec()-Executes the specified code (or object)
  • For Example, x  'name
    "John"\nprint(name)'exec(x)
  • Filter()-Use a filter function to exclude items
    in a iterable object
  • For Example,
  • ages 5, 12, 17, 18, 24, 32
    def myFunc(x)  if x lt 18    return False  e
    lse    return True

5
  • adults  filter(myFunc, ages)for x in adults  
    print(x)
  • Float()- Returns a floating point number
  • For Example, x  float(3)
  • Format()-Formats a specified value
  • For Example, x  format(0.5, '')
  • Forzenset()-Returns a frozenset object
  • For Example, mylist
    'apple', 'banana', 'cherry'x
     frozenset(mylist)

6
  • Getattr()-Returns the value of the specified
    attribute (property or method)
  • For Example, class Person 
    name  "John"  age  36  country  "Norway"x
     getattr(Person, 'age')
  • Globals-Returns the current global symbol table
    as a dictionary
  • For Example, x  globals()print(x)

7
  • Hash()-Returns the hash value of a specified
    object
  • Hex()-Converts a number into a hexadecimal value
  • For Example, x  hex(255)
  • Id()-Returns the id of an object
  • For Example, x  ('apple', 'banana', '
    cherry')y  id(x)
  • Input()-Allowing user input
  • For Example, print('Enter your name')
  • x  input()print('Hello, '  x)

8
  • Len() Returns the length of an object
  • For Example, mylist
    "apple", "banana", "cherry"x  len(mylist)
  • List()-Returns a list
  • For Example, x  list(('apple', 'banan
    a', 'cherry'))
  • Locals()- Returns an updated dictionary of the
    current local symbol table
  • For Example, x  locals()print(x)

9
  • Map()-Returns the specified iterator with the
    specified function applied to each item
  • For Example, def myfunc(n)  return 
    len(n)x  map(myfunc, ('apple', 'banana', 'cherr
    y'))
  • Max()-Returns the largest item in an iterable
  • For Example, x  max(5, 10)
  • Min()-Returns the smallest item in an iterable
  • For Example, a (1, 5, 3, 9)x  min(a)

10
  • Ord()-Convert an integer representing the Unicode
    of the specified character
  • For Example, x  ord("h")
  • Pow()-Returns the value of x to the power of y
  • For Example, x  pow(4, 3)
  • Print()-Prints to the standard output device
  • For Example,  print("Hello World")
  • Range()-Returns a sequence of numbers, starting
    from 0 and increments by 1 (by default)
  • For Example, x  range(6)for n in x
      print(n)

11
  • Set()-Returns a new set object
  • For Example, x  set(('apple', 'bana
    na', 'cherry'))
  • Sort()-Returns a sorted list
  • For Example, a ("a", "b", "c", "d",
     "e", "f", "g", "h")x  slice(2)print(ax)
  • Tuple()-Returns a tuple
  • For Example, x  tuple(('apple', 'bana
    na', 'cherry'))

12
GREENS TECHNOLOGYS
  • Greens Technology is a leading Training and
    Placements company in Chennai. We are known for
    our practical approach towards trainings that
    enable students to gain real-time exposure on
    competitive technologies. Trainings are offered
    by employees from MNCs to give a real corporate
    exposure.
Write a Comment
User Comments (0)
About PowerShow.com