print("######abs funciton")
# integer number
integer = -20
print('Absolute value of -20 is:', abs(integer))
# floating number
floating = -20.83
print('Absolute value of -20.83 is:', abs(floating))
print("=======================================")
print("#####ALL funtion")
# all values true
k = [1, 3, 4, 6]
print(all(k))
# all values false
k = [0, False]
print(all(k))
# one false value
k = [1, 3, 7, 0]
print(all(k))
# one true value
k = [0, False, 5]
print(all(k))
# empty iterable
k = []
print(all(k))
print("=======================================")
print("#####BIN funtion")
x = 10
y = bin(x)
print (y)
print("=======================================")
print("#####BOOL funtion")
test1 = []
print(test1,'is',bool(test1))
test1 = [0]
print(test1,'is',bool(test1))
test1 = 0.0
print(test1,'is',bool(test1))
test1 = None
print(test1,'is',bool(test1))
test1 = True
print(test1,'is',bool(test1))
test1 = 'Easy string'
print(test1,'is',bool(test1))
print("=======================================")
print("#####BYTES funtion")
string = "Hello World."
array = bytes(string, 'utf-8')
print(array)
print("=======================================")
print("#####callable funtion")
x = 8
print(callable(x))
print("=======================================")
print("#####EXEC funtion")
x = 8
exec('print(x==8)')
exec('print(x+4)')
print("=======================================")
print("#####SUM funtion")
s = sum([1, 2,4 ])
print(s)
s = sum([1, 2, 4], 10)
print(s)
print("=======================================")
print("#####ANY funtion")
l = [4, 3, 2, 0]
print(any(l))
l = [0, False]
print(any(l))
l = [0, False, 5]
print(any(l))
l = []
print(any(l))
print("=======================================")
print("#####ASCII funtion")
normalText = 'Python is interesting'
print(ascii(normalText))
otherText = 'Pythön is interesting'
print(ascii(otherText))
print('Pyth\xf6n is interesting')
print("=======================================")
print("#####EVAL funtion")
x = 8
print(eval('x + 1'))
print("=======================================")
print("#####FLOAT funtion")
# for integers
print(float(9))
# for floats
print(float(8.19))
# for string floats
print(float("-24.27"))
# for string floats with whitespaces
print(float(" -17.19\n"))
print("=======================================")
print("#####FORMAT funtion")
# d, f and b are a type
# integer
print(format(123, "d"))
# float arguments
print(format(123.4567898, "f"))
# binary format
print(format(12, "b"))
print("=======================================")
print("#####frozenset() funtion")
# tuple of letters
letters = ('m', 'r', 'o', 't', 's')
fSet = frozenset(letters)
print('Frozen set is:', fSet)
print('Empty frozen set is:', frozenset())
print("=======================================")
print("#####POW() funtion")
# positive x, positive y (x**y)
print(pow(4, 2))
# negative x, positive y
print(pow(-4, 2))
# positive x, negative y (x**-y)
print(pow(4, -2))
# negative x, negative y
print(pow(-4, -2))
print("=======================================")
print("#####print() funtion")
print("Python is programming language.")
x = 7
# Two objects passed
print("x =", x)
y = x
# Three objects passed
print('x =', x, '= y')
print(pow(-4, -2))
print("=======================================")
print("#####range() funtion")
# empty range
print(list(range(0)))
# using the range(stop)
print(list(range(4)))
# using the range(start, stop)
print(list(range(1,7 )))
print("=======================================")
print("#####reversed() funtion")
# for string
String = 'Java'
print(list(reversed(String)))
# for tuple
Tuple = ('J', 'a', 'v', 'a')
print(list(reversed(Tuple)))
# for range
Range = range(8, 12)
print(list(reversed(Range)))
# for list
List = [1, 2, 7, 5]
print(list(reversed(List)))
print("=======================================")
print("#####Round() funtion")
# for integers
print(round(10))
# for floating point
print(round(10.8))
# even choice
print(round(6.6))
print("=======================================")
print("#####TUPLE() funtion")
t1 = tuple()
print('t1=', t1)
# creating a tuple from a list
t2 = tuple([1, 6, 9])
print('t2=', t2)
# creating a tuple from a string
t1 = tuple('Java')
print('t1=',t1)
# creating a tuple from a dictionary
t1 = tuple({4: 'four', 5: 'five'})
print('t1=',t1)
print("=======================================")
print("#####TYPE() funtion")
List = [4, 5]
print(type(List))
Dict = {4: 'four', 5: 'five'}
print(type(Dict))
class Python:
a = 0
InstanceOfPython = Python()
print(type(InstanceOfPython))
# integer number
integer = -20
print('Absolute value of -20 is:', abs(integer))
# floating number
floating = -20.83
print('Absolute value of -20.83 is:', abs(floating))
print("=======================================")
print("#####ALL funtion")
# all values true
k = [1, 3, 4, 6]
print(all(k))
# all values false
k = [0, False]
print(all(k))
# one false value
k = [1, 3, 7, 0]
print(all(k))
# one true value
k = [0, False, 5]
print(all(k))
# empty iterable
k = []
print(all(k))
print("=======================================")
print("#####BIN funtion")
x = 10
y = bin(x)
print (y)
print("=======================================")
print("#####BOOL funtion")
test1 = []
print(test1,'is',bool(test1))
test1 = [0]
print(test1,'is',bool(test1))
test1 = 0.0
print(test1,'is',bool(test1))
test1 = None
print(test1,'is',bool(test1))
test1 = True
print(test1,'is',bool(test1))
test1 = 'Easy string'
print(test1,'is',bool(test1))
print("=======================================")
print("#####BYTES funtion")
string = "Hello World."
array = bytes(string, 'utf-8')
print(array)
print("=======================================")
print("#####callable funtion")
x = 8
print(callable(x))
print("=======================================")
print("#####EXEC funtion")
x = 8
exec('print(x==8)')
exec('print(x+4)')
print("=======================================")
print("#####SUM funtion")
s = sum([1, 2,4 ])
print(s)
s = sum([1, 2, 4], 10)
print(s)
print("=======================================")
print("#####ANY funtion")
l = [4, 3, 2, 0]
print(any(l))
l = [0, False]
print(any(l))
l = [0, False, 5]
print(any(l))
l = []
print(any(l))
print("=======================================")
print("#####ASCII funtion")
normalText = 'Python is interesting'
print(ascii(normalText))
otherText = 'Pythön is interesting'
print(ascii(otherText))
print('Pyth\xf6n is interesting')
print("=======================================")
print("#####EVAL funtion")
x = 8
print(eval('x + 1'))
print("=======================================")
print("#####FLOAT funtion")
# for integers
print(float(9))
# for floats
print(float(8.19))
# for string floats
print(float("-24.27"))
# for string floats with whitespaces
print(float(" -17.19\n"))
print("=======================================")
print("#####FORMAT funtion")
# d, f and b are a type
# integer
print(format(123, "d"))
# float arguments
print(format(123.4567898, "f"))
# binary format
print(format(12, "b"))
print("=======================================")
print("#####frozenset() funtion")
# tuple of letters
letters = ('m', 'r', 'o', 't', 's')
fSet = frozenset(letters)
print('Frozen set is:', fSet)
print('Empty frozen set is:', frozenset())
print("=======================================")
print("#####POW() funtion")
# positive x, positive y (x**y)
print(pow(4, 2))
# negative x, positive y
print(pow(-4, 2))
# positive x, negative y (x**-y)
print(pow(4, -2))
# negative x, negative y
print(pow(-4, -2))
print("=======================================")
print("#####print() funtion")
print("Python is programming language.")
x = 7
# Two objects passed
print("x =", x)
y = x
# Three objects passed
print('x =', x, '= y')
print(pow(-4, -2))
print("=======================================")
print("#####range() funtion")
# empty range
print(list(range(0)))
# using the range(stop)
print(list(range(4)))
# using the range(start, stop)
print(list(range(1,7 )))
print("=======================================")
print("#####reversed() funtion")
# for string
String = 'Java'
print(list(reversed(String)))
# for tuple
Tuple = ('J', 'a', 'v', 'a')
print(list(reversed(Tuple)))
# for range
Range = range(8, 12)
print(list(reversed(Range)))
# for list
List = [1, 2, 7, 5]
print(list(reversed(List)))
print("=======================================")
print("#####Round() funtion")
# for integers
print(round(10))
# for floating point
print(round(10.8))
# even choice
print(round(6.6))
print("=======================================")
print("#####TUPLE() funtion")
t1 = tuple()
print('t1=', t1)
# creating a tuple from a list
t2 = tuple([1, 6, 9])
print('t2=', t2)
# creating a tuple from a string
t1 = tuple('Java')
print('t1=',t1)
# creating a tuple from a dictionary
t1 = tuple({4: 'four', 5: 'five'})
print('t1=',t1)
print("=======================================")
print("#####TYPE() funtion")
List = [4, 5]
print(type(List))
Dict = {4: 'four', 5: 'five'}
print(type(Dict))
class Python:
a = 0
InstanceOfPython = Python()
print(type(InstanceOfPython))
OUTPUT:
######abs funciton
Absolute value of -20 is: 20
Absolute value of -20.83 is: 20.83
=======================================
#####ALL funtion
True
False
False
False
True
=======================================
#####BIN funtion
0b1010
=======================================
#####BOOL funtion
[] is False
[0] is True
0.0 is False
None is False
True is True
Easy string is True
=======================================
#####BYTES funtion
b'Hello World.'
=======================================
#####callable funtion
False
=======================================
#####EXEC funtion
True
12
=======================================
#####SUM funtion
7
17
=======================================
#####ANY funtion
True
False
True
False
=======================================
#####ASCII funtion
'Python is interesting'
'Pyth\xf6n is interesting'
Pythön is interesting
=======================================
#####EVAL funtion
9
=======================================
#####FLOAT funtion
9.0
8.19
-24.27
-17.19
=======================================
#####FORMAT funtion
123
123.456790
1100
=======================================
#####frozenset() funtion
Frozen set is: frozenset({'m', 'o', 's', 'r', 't'})
Empty frozen set is: frozenset()
=======================================
#####POW() funtion
16
16
0.0625
0.0625
=======================================
#####print() funtion
Python is programming language.
x = 7
x = 7 = y
0.0625
=======================================
#####range() funtion
[]
[0, 1, 2, 3]
[1, 2, 3, 4, 5, 6]
=======================================
#####reversed() funtion
['a', 'v', 'a', 'J']
['a', 'v', 'a', 'J']
[11, 10, 9, 8]
[5, 7, 2, 1]
=======================================
#####Round() funtion
10
11
7
=======================================
#####TUPLE() funtion
t1= ()
t2= (1, 6, 9)
t1= ('J', 'a', 'v', 'a')
t1= (4, 5)
=======================================
#####TYPE() funtion
<class 'list'>
<class 'dict'>
<class '__main__.Python'>