/ Python And R Data science skills: 14 DS Python Built in Functions in telugu vlr training

Sunday 4 February 2018

14 DS Python Built in Functions in telugu vlr training

14 Functions in Python (built in functions)
In [1]:
"""
(1) In programming, a named section of a program that performs a specific task. In this sense, a function is a type of procedure or routine. Some programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value.

Most programming languages come with a prewritten set of functions that are kept in a library. You can also write your own functions to perform specialized tasks.

(2) The term function is also used synonymously with operation and command. For example, you execute the delete function to erase a word
"""
Out[1]:
'\n(1) In programming, a named section of a program that performs a specific task. In this sense, a function is a type of procedure or routine. Some programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value.\n\nMost programming languages come with a prewritten set of functions that are kept in a library. You can also write your own functions to perform specialized tasks.\n\n(2) The term function is also used synonymously with operation and command. For example, you execute the delete function to erase a word\n'
In [4]:
print("hi")
#https://www.programiz.com/python-programming/methods/built-in
hi
In [5]:
a=[1,33,44,6,9,0]
In [6]:
len(a)
Out[6]:
6
In [7]:
print(a)
[1, 33, 44, 6, 9, 0]
In [8]:
abs(-1)
Out[8]:
1
In [9]:
abs(20)
Out[9]:
20
In [11]:
abs(-.99)
Out[11]:
0.99
In [13]:
all(a)
Out[13]:
False
In [14]:
a=[1,3,5]
In [15]:
all(a)
Out[15]:
True
In [16]:
min(a)
Out[16]:
1
In [17]:
max(a)
Out[17]:
5

min(2,5,9,7)

In [18]:
min(2,5,6,7)
Out[18]:
2
In [19]:
min[2,4,5]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-19-5255376d8082> in <module>()
----> 1 min[2,4,5]

TypeError: 'builtin_function_or_method' object is not subscriptable
In [20]:
a=10
In [21]:
float(a)
Out[21]:
10.0
In [22]:
a
Out[22]:
10
In [23]:
hex(10)
Out[23]:
'0xa'
In [24]:
hex(11)
Out[24]:
'0xb'
In [25]:
bin(2)
Out[25]:
'0b10'
In [26]:
bin(10)
Out[26]:
'0b1010'
In [31]:
a=[-1,0,False,3]
In [30]:
any(a)
Out[30]:
True
In [32]:
boll(1)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-32-b2e402ad280c> in <module>()
----> 1 boll(1)

NameError: name 'boll' is not defined
In [33]:
bool(1)
Out[33]:
True
In [34]:
bool(0)
Out[34]:
False
In [35]:
bool(-99)
Out[35]:
True
In [36]:
bool(False)
Out[36]:
False
In [38]:
bool(True)
Out[38]:
True
In [39]:
import scrapy
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-39-51c73a18167b> in <module>()
----> 1 import scrapy

ModuleNotFoundError: No module named 'scrapy'

No comments:

Post a Comment