Standard Data Types in Python
Standard Data Types in Python
>>> keywords
keywords
>>> help
Type help() for interactive help, or help(object) for help about object.
>>> help()
If this is your first time using Python, you should definitely check out
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
with a one-line summary of what it does; to list the modules whose name
help> keywords
Here is a list of the Python keywords. Enter any keyword to get more help.
False class from or
as elif in try
help> symbols
Here is a list of the punctuation symbols which Python assigns special meaning
!= + <= __
" += <> `
""" , == b"
% - > b'
%= -= >= f"
' / @ r"
''' // J r'
( //= [ u"
) /= \ u'
* : ] |
** < ^ |=
**= << ^= ~
*= <<= _
help> exit
| exit(name, eof)
| __call__(self, code=None)
| __repr__(self)
| Return repr(self).
| ----------------------------------------------------------------------
| __dict__
| __weakref__
help> quit
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
has the same effect as typing a particular string at the help> prompt.
>>> class= 10
Hello python
>>> type(print)
<class 'builtin_function_or_method'>
>>> print=100
100
print("Hello world")
>>> a=b=c=100
>>> a
100
>>> b
100
>>> c
100
>>> x=5
>>> x=10
>>> x=15
>>> x
15
>>> x=5
>>> print("x="+x)
print("x="+x)
>>> x=5
>>> print('x='+x)
print('x='+x)
>>> x
>>> print(x)
print(x)
>>> y=5
>>> print("y="+y)
>>> x=10
>>> x
10
>>> type(x)
<class 'int'>
>>> id(x)
140733858476576
>>> str(x)
'10'
>>> type(x)
<class 'int'>
>>> x
10
>>> a=10
>>> b=20
>>> a,b=b,a
>>> a
20
>>> b
10
>>> a,b,c=10,20,30
>>> a
10
>>> b
20
>>>
>>> c
30
>>> x=10
>>> type(x)
<class 'int'>
>>> x="hello"
>>> x
'hello'
>>> type(x)
<class 'str'>
>>> a=10
>>> a
10
>>> c
30
>>> f
>>> del c
>>> c
>>> a
>>> b
>>> c
>>> a=10
>>> a
10
>>> b=20
>>> b
20
>>> print(a-b)
print(a-b)
>>> x=3-4j
>>> x
(3-4j)
>>> x.real
3.0
>>> x.imaginary
x.imaginary
>>> x.imag
-4.0
>>> x=5+12j
>>> z=3-4j
>>> print(z+x,z-x,z*x,x/z,sep="u")
print(z+x,z-x,z*x,x/z,sep="u")
>>> x=True
>>> type(x)
<class 'bool'>
>>> type("False")
<class 'str'>
>>> type(False)
<class 'bool'>
>>> type(none)
>>> type(None)
<class 'NoneType'>
>>> print(s1+s2)
print(s1+s2)
>>> s1+s2
>>> s2*3
>>> s1[0]
'H'
>>> s1[0:4]
'Hell'
>>> s1[:4]
'Hell'
>>> s1[0:len(s1):2]
'Hlopto'
>>> s1[-1]
'n'
>>> s1[-1:0]
''
>>> s1[:-1]
'Hello pytho'
>>> s1[-1:]
'n'
>>> s1[::]
'Hello python'
>>> s1[::-1]
'nohtyp olleH'
>>> s3=s1+s2
>>> s3
print(s1 in s3)
>>> s1 in s3
True
>>> s1 not in s3
False
>>> s in s2
s in s2
>>> s1 in s2
False
>>> s2 in s3
True
>>> s2 in s1
False
29
>>> len(s1)
12
>>> t1
>>> t2=("python",220,300,False)
>>> t2
>>> t1+t2
('hello', 10, 29, -39, True, None, 'python', 220, 300, False)
>>> t1[0:]
>>> t1[::]
>>> t1[::-1]
>>> t1[-1]
>>> t1[:-1]
>>> t1[:4]
>>> t1[2:4]
(29, -39)
>>> t1[0]
'hello'
>>> t1[0]=100
t1[0]=100
>>> l1
l1
>>> l1=["hello",345,True]
>>> l2=["world",456,False]
>>> l1+l2
>>> l1*5
['hello', 345, True, 'hello', 345, True, 'hello', 345, True, 'hello', 345, True, 'hello', 345, True]
>>> l1[::]
>>> l1[0]
'hello'
>>> l1[0]=True
>>> l1
>>> l1[::-1]
>>> l1.pop()
True
>>> l1.pop(0)
True
>>> l1.pop(-1)
345
>>> l1.pop(1)
l1.pop(1)
>>> l3=[1,5.6.True,4-5j,["Hello",5,False],["python",None,4.5]]
>>> l3=[1,5,6,True,4-5j,["Hello",5,False],["Python",None,4.5]]
print(i,num)
print(i,num)
>>> l1=[20,30,40,50]
print(i,num)
Traceback (most recent call last):
print(i,num)
print(i)
print(i)
print(l1[i])
print(l1[i])
>>> max(l1)
50
>>> min(l1)
20
>>> pop(l1)
pop(l1)
>>> set1
>>> set1
>>> set2=set("Welcome")
>>> set2
>>> set.add("x")
set.add("x")
>>> set2.add("x")
>>> set2
>>> s2=frozenset{10,20,30,44,55}
>>> s2=frozenset(10,20,30,44,55)
s2=frozenset(10,20,30,44,55)
>>> s3=frozenset(["osman","nivesh"])
>>> s3
frozenset({'osman', 'nivesh'})
>>> set1
>>> dict1{1:10,2:20,3:30,4:40}
SyntaxError: invalid syntax
>>> dict1={1:10,2:20,3:30,4:40}
>>> dict1[2]
20
>>> dict1
>>> len(dict1\)
>>> len(dict1)
>>> dict1.add(5:50)
>>> dict1.add(5)
dict1.add(5)
>>> dict1.values()
>>> capitals.keys()
capitals.keys()
>>> dict1.items()
>>> dict1[5]=50
>>> dict1
{1: 10, 2: 20, 3: 30, 4: 40, 5: 50}
print(dict1[i])
for i in dict1():
print(capitals[i])
print(capitals[i])
print(dict1[i])
for i in dict1():