Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.
1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> keywords
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
keywords
NameError: name 'keywords' is not defined
>>> help
Type help() for interactive help, or help(object) for help about object.
>>> help()
Welcome to Python 3.7's help utility!
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.
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
return to the interpreter, just type "quit".
To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics". Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".
help> keywords
Here is a list of the Python keywords. Enter any keyword to get more help.
False class from or
None continue global pass
True def if raise
and del import return
as elif in try
assert else is while
async except lambda with
await finally nonlocal yield
break for not
help> symbols
Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.
!= + <= __
" += <> `
""" , == b"
% - > b'
%= -= >= f"
& . >> f'
&= ... >>= j
' / @ r"
''' // J r'
( //= [ u"
) /= \ u'
* : ] |
** < ^ |=
**= << ^= ~
*= <<= _
help> exit
Help on Quitter in module _sitebuiltins object:
exit = class Quitter(builtins.object)
| exit(name, eof)
| Methods defined here:
| __call__(self, code=None)
| Call self as a function.
| __init__(self, name, eof)
| Initialize self. See help(type(self)) for accurate signature.
| __repr__(self)
| Return repr(self).
| ----------------------------------------------------------------------
| Data descriptors defined here:
| __dict__
| dictionary for instance variables (if defined)
| __weakref__
| list of weak references to the object (if defined)
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
interpreter, you can type "help(object)". Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
>>> class= 10
SyntaxError: invalid syntax
>>> print("Hello python")
Hello python
>>> print
<built-in function print>
>>> type(print)
<class 'builtin_function_or_method'>
>>> print=100
>>> print
100
>>> print("Hello world")
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
print("Hello world")
TypeError: 'int' object is not callable
>>> a=b=c=100
>>> print a,b,c
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(a,b,c)?
>>> a
100
>>> b
100
>>> c
100
>>> x=5
>>> x=10
>>> x=15
>>> x
15
>>> x=5
>>> print("x="+x)
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
print("x="+x)
TypeError: can only concatenate str (not "int") to str
>>> x=5
>>> print('x='+x)
Traceback (most recent call last):
File "<pyshell#22>", line 1, in <module>
print('x='+x)
TypeError: can only concatenate str (not "int") to str
>>> x
>>> print(x)
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
print(x)
TypeError: 'int' object is not callable
>>> y=5
>>> print("y="+y)
Traceback (most recent call last):
File "<pyshell#26>", line 1, in <module>
print("y="+y)
TypeError: can only concatenate str (not "int") to str
>>> 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
Traceback (most recent call last):
File "<pyshell#52>", line 1, in <module>
NameError: name 'f' is not defined
>>> del c
>>> c
Traceback (most recent call last):
File "<pyshell#54>", line 1, in <module>
NameError: name 'c' is not defined
>>> del a,b,c
Traceback (most recent call last):
File "<pyshell#55>", line 1, in <module>
del a,b,c
NameError: name 'c' is not defined
>>> a
Traceback (most recent call last):
File "<pyshell#56>", line 1, in <module>
NameError: name 'a' is not defined
>>> b
Traceback (most recent call last):
File "<pyshell#57>", line 1, in <module>
NameError: name 'b' is not defined
>>> c
Traceback (most recent call last):
File "<pyshell#58>", line 1, in <module>
NameError: name 'c' is not defined
>>> a=10
>>> a
10
>>> b=20
>>> b
20
>>> print(a-b)
Traceback (most recent call last):
File "<pyshell#63>", line 1, in <module>
print(a-b)
TypeError: 'int' object is not callable
>>> x=3-4j
>>> x
(3-4j)
>>> x.real
3.0
>>> x.imaginary
Traceback (most recent call last):
File "<pyshell#67>", line 1, in <module>
x.imaginary
AttributeError: 'complex' object has no attribute 'imaginary'
>>> x.imag
-4.0
>>> x=5+12j
>>> z=3-4j
>>> print(z+x,z-x,z*x,x/z,sep="u")
Traceback (most recent call last):
File "<pyshell#71>", line 1, in <module>
print(z+x,z-x,z*x,x/z,sep="u")
TypeError: 'int' object is not callable
>>> x=True
>>> type(x)
<class 'bool'>
>>> type("False")
<class 'str'>
>>> type(False)
<class 'bool'>
>>> type(none)
Traceback (most recent call last):
File "<pyshell#76>", line 1, in <module>
type(none)
NameError: name 'none' is not defined
>>> type(None)
<class 'NoneType'>
>>> s1= "Hello python"
>>> s2="Welcome to python"
>>> print(s1+s2)
Traceback (most recent call last):
File "<pyshell#80>", line 1, in <module>
print(s1+s2)
TypeError: 'int' object is not callable
>>> s1+s2
'Hello pythonWelcome to python'
>>> s1+' '+s2
'Hello python Welcome to python'
>>> s2*3
'Welcome to pythonWelcome to pythonWelcome to python'
>>> 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
'Hello pythonWelcome to python'
>>> print(s1in s3)
SyntaxError: invalid syntax
>>> print(s1 in s3)
Traceback (most recent call last):
File "<pyshell#97>", line 1, in <module>
print(s1 in s3)
TypeError: 'int' object is not callable
>>> s1 in s3
True
>>> s1 not in s3
False
>>> s in s2
Traceback (most recent call last):
File "<pyshell#100>", line 1, in <module>
s in s2
NameError: name 's' is not defined
>>> s1 in s2
False
>>> s2 in s3
True
>>> s2 in s1
False
>>> len (s3)
29
>>> len(s1)
12
>>> t1=("hello", 10,29,-39,True,None)
>>> t1
('hello', 10, 29, -39, True, None)
>>> t2=("python",220,300,False)
>>> t2
('python', 220, 300, False)
>>> t1+t2
('hello', 10, 29, -39, True, None, 'python', 220, 300, False)
>>> t1[0:]
('hello', 10, 29, -39, True, None)
>>> t1[::]
('hello', 10, 29, -39, True, None)
>>> t1[::-1]
(None, True, -39, 29, 10, 'hello')
>>> t1[-1]
>>> t1[:-1]
('hello', 10, 29, -39, True)
>>> t1[:4]
('hello', 10, 29, -39)
>>> t1[2:4]
(29, -39)
>>> t1[0]
'hello'
>>> t1[0]=100
Traceback (most recent call last):
File "<pyshell#119>", line 1, in <module>
t1[0]=100
TypeError: 'tuple' object does not support item assignment
>>> l1=["world", 123,456,-098,3j-4h,True,None]
SyntaxError: invalid token
>>> l1
Traceback (most recent call last):
File "<pyshell#121>", line 1, in <module>
l1
NameError: name 'l1' is not defined
>>> l1=["hello",345,True]
>>> l2=["world",456,False]
>>> l1+l2
['hello', 345, True, 'world', 456, False]
>>> l1*5
['hello', 345, True, 'hello', 345, True, 'hello', 345, True, 'hello', 345, True, 'hello', 345, True]
>>> l1[::]
['hello', 345, True]
>>> l1[0]
'hello'
>>> l1[0]=True
>>> l1
[True, 345, True]
>>> l1[::-1]
[True, 345, True]
>>> l1.copy()
[True, 345, True]
>>> l1.pop()
True
>>> l1.pop(0)
True
>>> l1.pop(-1)
345
>>> l1.pop(1)
Traceback (most recent call last):
File "<pyshell#135>", line 1, in <module>
l1.pop(1)
IndexError: pop from empty list
>>> l3=[1,5.6.True,4-5j,["Hello",5,False],["python",None,4.5]]
SyntaxError: invalid syntax
>>> l3=[1,5,6,True,4-5j,["Hello",5,False],["Python",None,4.5]]
>>> for i,num in enumerate(l3):
print(i,num)
Traceback (most recent call last):
File "<pyshell#140>", line 2, in <module>
print(i,num)
TypeError: 'int' object is not callable
>>> l1=[20,30,40,50]
>>> for i ,num in enumerate(l1):
print(i,num)
Traceback (most recent call last):
File "<pyshell#144>", line 2, in <module>
print(i,num)
TypeError: 'int' object is not callable
>>> for i in range(len(l1)):
print(i)
Traceback (most recent call last):
File "<pyshell#147>", line 2, in <module>
print(i)
TypeError: 'int' object is not callable
>>> for i in range(len(l1)):
print(l1[i])
Traceback (most recent call last):
File "<pyshell#150>", line 2, in <module>
print(l1[i])
TypeError: 'int' object is not callable
>>> max(l1)
50
>>> min(l1)
20
>>> pop(l1)
Traceback (most recent call last):
File "<pyshell#153>", line 1, in <module>
pop(l1)
NameError: name 'pop' is not defined
>>> set1={1,10,20,50,60}
>>> set1
{1, 10, 50, 20, 60}
>>> set1
{1, 10, 50, 20, 60}
>>> set2=set("Welcome")
>>> set2
{'c', 'e', 'W', 'l', 'o', 'm'}
>>> set.add("x")
Traceback (most recent call last):
File "<pyshell#159>", line 1, in <module>
set.add("x")
TypeError: descriptor 'add' requires a 'set' object but received a 'str'
>>> set2.add("x")
>>> set2
{'c', 'e', 'x', 'W', 'l', 'o', 'm'}
>>> s2=frozenset{10,20,30,44,55}
SyntaxError: invalid syntax
>>> s2=frozenset(10,20,30,44,55)
Traceback (most recent call last):
File "<pyshell#163>", line 1, in <module>
s2=frozenset(10,20,30,44,55)
TypeError: frozenset expected at most 1 arguments, got 5
>>> s3=frozenset(["osman","nivesh"])
>>> s3
frozenset({'osman', 'nivesh'})
>>> set1
{1, 10, 50, 20, 60}
>>> 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
{1: 10, 2: 20, 3: 30, 4: 40}
>>> len(dict1\)
SyntaxError: unexpected character after line continuation character
>>> len(dict1)
>>> dict1.add(5:50)
SyntaxError: invalid syntax
>>> dict1.add(5)
Traceback (most recent call last):
File "<pyshell#174>", line 1, in <module>
dict1.add(5)
AttributeError: 'dict' object has no attribute 'add'
>>> dict1.values()
dict_values([10, 20, 30, 40])
>>> capitals.keys()
Traceback (most recent call last):
File "<pyshell#176>", line 1, in <module>
capitals.keys()
NameError: name 'capitals' is not defined
>>> dict1.items()
dict_items([(1, 10), (2, 20), (3, 30), (4, 40)])
>>> dict1[5]=50
>>> dict1
{1: 10, 2: 20, 3: 30, 4: 40, 5: 50}
>>> for i in dict1():
print(dict1[i])
Traceback (most recent call last):
File "<pyshell#182>", line 1, in <module>
for i in dict1():
TypeError: 'dict' object is not callable
>>> for i in dict1.keys():
print(capitals[i])
Traceback (most recent call last):
File "<pyshell#185>", line 2, in <module>
print(capitals[i])
NameError: name 'capitals' is not defined
>>> for i in dict1.keys()
SyntaxError: invalid syntax
>>> for i in dict1():
print(dict1[i])
Traceback (most recent call last):
File "<pyshell#189>", line 1, in <module>
for i in dict1():
TypeError: 'dict' object is not callable