Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.
1900 32 bit (Intel)] on
win32
Type "copyright", "credits" or "license()" for more information.
>>> #variable declaration
>>> name+"rachit"
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
name+"rachit"
NameError: name 'name' is not defined
>>> name="rachit"
>>> print(name)
rachit
>>> Name=("Rachit")
>>> print(name)
rachit
>>> print(Name)
Rachit
>>> SName,sname
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
SName,sname
NameError: name 'SName' is not defined
>>> sName,sname="Rachit"
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
sName,sname="Rachit"
ValueError: too many values to unpack (expected 2)
>>>
======== RESTART: C:/Users/Student.ISPS/Documents/Codes/first code.py ========
5
>>>
KeyboardInterrupt
>>>
KeyboardInterrupt
>>>
=========== RESTART: C:/Users/Student.ISPS/Documents/Codes/num.py ===========
5
>>> type(%)
SyntaxError: invalid syntax
>>> type(?)
SyntaxError: invalid syntax
>>> type(@)
SyntaxError: invalid syntax
>>> int(name)
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
int(name)
NameError: name 'name' is not defined
>>> NAME
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
NAME
NameError: name 'NAME' is not defined
>>> name
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
name
NameError: name 'name' is not defined
>>> Name
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
Name
NameError: name 'Name' is not defined
>>> new
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
new
NameError: name 'new' is not defined
>>> NameError: name 'new' is not defined
SyntaxError: invalid syntax
>>>
>>>
>>>
>>>
>>> lets go
SyntaxError: invalid syntax
>>> lets
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
lets
NameError: name 'lets' is not defined
>>> let
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
let
NameError: name 'let' is not defined
>>> type(let)
Traceback (most recent call last):
File "<pyshell#25>", line 1, in <module>
type(let)
NameError: name 'let' is not defined
>>> type(name)
Traceback (most recent call last):
File "<pyshell#26>", line 1, in <module>
type(name)
NameError: name 'name' is not defined
>>> PRINT("NAME")
Traceback (most recent call last):
File "<pyshell#27>", line 1, in <module>
PRINT("NAME")
NameError: name 'PRINT' is not defined
>>> print("name")
name
>>> #lists
>>> log3
Traceback (most recent call last):
File "<pyshell#30>", line 1, in <module>
log3
NameError: name 'log3' is not defined
>>>
>>> number=[0,1,2,3,4,5]
SyntaxError: unexpected indent
>>> number=[0,1,2,3,4,5]
>>> number[3]
3
>>> number[5]
5
>>> number[6]
Traceback (most recent call last):
File "<pyshell#36>", line 1, in <module>
number[6]
IndexError: list index out of range
>>> number[5.5]
Traceback (most recent call last):
File "<pyshell#37>", line 1, in <module>
number[5.5]
TypeError: list indices must be integers or slices, not float
>>> time=("10:14")
>>> print(time)
10:14
>>> DATE=("8.10.2018")
>>> print(DATE)
8.10.2018
>>> print(number{[3])
SyntaxError: invalid syntax
>>> print(number[3])
3
>>> number.append(6)
>>> number
[0, 1, 2, 3, 4, 5, 6]
>>> number.append(8-2)
>>> number
[0, 1, 2, 3, 4, 5, 6, 6]
>>> type(append)
Traceback (most recent call last):
File "<pyshell#48>", line 1, in <module>
type(append)
NameError: name 'append' is not defined
>>> name[append]
Traceback (most recent call last):
File "<pyshell#49>", line 1, in <module>
name[append]
NameError: name 'name' is not defined
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> number.sort()
>>> number.sort
<built-in method sort of list object at 0x005B6BE8>
>>> number.reverse()
>>> student=[anmol,abhay]
Traceback (most recent call last):
File "<pyshell#68>", line 1, in <module>
student=[anmol,abhay]
NameError: name 'anmol' is not defined
>>> student["anmiol","abhay"]
Traceback (most recent call last):
File "<pyshell#69>", line 1, in <module>
student["anmiol","abhay"]
NameError: name 'student' is not defined
>>> student="abhay"
>>> student= "anmol"
>>> student=[abhay,anmol]
Traceback (most recent call last):
File "<pyshell#72>", line 1, in <module>
student=[abhay,anmol]
NameError: name 'abhay' is not defined
>>> student["abhay,"anmol"]
SyntaxError: invalid syntax
>>> number.reverse[]
SyntaxError: invalid syntax
>>> number.reverse()
>>> print(number)
[0, 1, 2, 3, 4, 5, 6, 6]
>>> number.reverse()
>>> print
<built-in function print>
>>> print.number
Traceback (most recent call last):
File "<pyshell#79>", line 1, in <module>
print.number
AttributeError: 'builtin_function_or_method' object has no attribute 'number'
>>> print(number)
[6, 6, 5, 4, 3, 2, 1, 0]
>>> number
[6, 6, 5, 4, 3, 2, 1, 0]
>>> number.sort()
>>> number
[0, 1, 2, 3, 4, 5, 6, 6]
>>> number.count(5)
1
>>> number.[2]=0
SyntaxError: invalid syntax
>>> number.remove(2)
>>> number
[0, 1, 3, 4, 5, 6, 6]
>>> number.remove(7)
Traceback (most recent call last):
File "<pyshell#88>", line 1, in <module>
number.remove(7)
ValueError: list.remove(x): x not in list
>>> number.remove(6)
>>> number
[0, 1, 3, 4, 5, 6]
\
>>> totalnumber
Traceback (most recent call last):
File "<pyshell#91>", line 1, in <module>
totalnumber
NameError: name 'totalnumber' is not defined
>>> number2=(10)
>>> totalnumber=number+number2
Traceback (most recent call last):
File "<pyshell#93>", line 1, in <module>
totalnumber=number+number2
TypeError: can only concatenate list (not "int") to list
>>> number2[10]
Traceback (most recent call last):
File "<pyshell#94>", line 1, in <module>
number2[10]
TypeError: 'int' object is not subscriptable
>>> number2["2"]
Traceback (most recent call last):
File "<pyshell#96>", line 1, in <module>
number2["2"]
TypeError: 'int' object is not subscriptable
>>> number2[10,2]
Traceback (most recent call last):
File "<pyshell#97>", line 1, in <module>
number2[10,2]
TypeError: 'int' object is not subscriptable
>>> number2=[10,2]
>>> totalnumer=number+number2
>>> totalnumber
Traceback (most recent call last):
File "<pyshell#100>", line 1, in <module>
totalnumber
NameError: name 'totalnumber' is not defined
>>> totalnumer
[0, 1, 3, 4, 5, 6, 10, 2]
>>> newnumber=[9]
>>> totalnumber=totalnumer+newnumber
>>> totalnumber
[0, 1, 3, 4, 5, 6, 10, 2, 9]
>>> number.sort()
>>> number
[0, 1, 3, 4, 5, 6]
>>> totalnumber.sort(0
total number
SyntaxError: invalid syntax
>>> totalnumber.sort()
>>> totalnumber
[0, 1, 2, 3, 4, 5, 6, 9, 10]
>>> totalnumber.reverse()
>>> totalnumber
[10, 9, 6, 5, 4, 3, 2, 1, 0]
>>> totalnumber.append[11]
Traceback (most recent call last):
File "<pyshell#113>", line 1, in <module>
totalnumber.append[11]
TypeError: 'builtin_function_or_method' object is not subscriptable
>>> totalnumber.append[11]
Traceback (most recent call last):
File "<pyshell#114>", line 1, in <module>
totalnumber.append[11]
TypeError: 'builtin_function_or_method' object is not subscriptable
>>> totalnumber.append=[11]
Traceback (most recent call last):
File "<pyshell#115>", line 1, in <module>
totalnumber.append=[11]
AttributeError: 'list' object attribute 'append' is read-only
>>> totalnumber.append9110
Traceback (most recent call last):
File "<pyshell#116>", line 1, in <module>
totalnumber.append9110
AttributeError: 'list' object has no attribute 'append9110'
>>> totalnumber.append(11)
>>> totalnumber
[10, 9, 6, 5, 4, 3, 2, 1, 0, 11]
>>> totalnumber.sort()
>>> toalnumber
Traceback (most recent call last):
File "<pyshell#120>", line 1, in <module>
toalnumber
NameError: name 'toalnumber' is not defined
>>> totalnumber
[0, 1, 2, 3, 4, 5, 6, 9, 10, 11]
>>> print(totalnumber)
[0, 1, 2, 3, 4, 5, 6, 9, 10, 11]
>>> totalnumber.count()
Traceback (most recent call last):
File "<pyshell#123>", line 1, in <module>
totalnumber.count()
TypeError: count() takes exactly one argument (0 given)
>>> totalnumber.count
<built-in method count of list object at 0x0235D328>
>>> totalnumber.remove(11)
>>> totalnumber
[0, 1, 2, 3, 4, 5, 6, 9, 10]
>>> #VARIABLE DECLARATION
>>> #dictionary
>>> #dictionary
>>> student1==["name":"hitesh","age":"16"]
SyntaxError: invalid syntax
>>> student1==["name"="hitesh","age"="16"]
SyntaxError: invalid syntax
>>>
>>> student1=["name":"hitesh","age":"16"]
SyntaxError: invalid syntax
>>> student1=["name":"hitesh","age":"16"]
SyntaxError: invalid syntax
>>> student1=["name"="hitesh","age"="16"]
SyntaxError: invalid syntax
>>> student1={"name":"hitesh","age":"16"}
>>> student1(name)
Traceback (most recent call last):
File "<pyshell#136>", line 1, in <module>
student1(name)
NameError: name 'name' is not defined
>>> student1("name")
Traceback (most recent call last):
File "<pyshell#137>", line 1, in <module>
student1("name")
TypeError: 'dict' object is not callable
>>> student1{"name"}
SyntaxError: invalid syntax
>>> student1["name"]
'hitesh'
>>> student1[age]
Traceback (most recent call last):
File "<pyshell#140>", line 1, in <module>
student1[age]
NameError: name 'age' is not defined
>>> student1["age"]
'16'
>>> student1.append{"school":"sawlwan public school"}
SyntaxError: invalid syntax
>>> student1.append("school":"sawlwan public school")
SyntaxError: invalid syntax
>>> student1.append {"school":"sawlwan public school"}
SyntaxError: invalid syntax
>>> student1.append("school":"sawlwan public school")
SyntaxError: invalid syntax
>>> student1.append("school"="sawlwan public school")
SyntaxError: unexpected indent
>>> student1.append("school":"sawlwan public school")
SyntaxError: invalid syntax
>>> student1.append("school"="sawlwan public school")
SyntaxError: keyword can't be an expression
>>> student1["school"="sawlwan public school"]
SyntaxError: invalid syntax
>>> >>> student1["school":"sawlwan public school"]
SyntaxError: invalid syntax
>>> student1["school":"sawlwan public school"]
Traceback (most recent call last):
File "<pyshell#151>", line 1, in <module>
student1["school":"sawlwan public school"]
TypeError: unhashable type: 'slice'
>>> student1["school":"sawlwan public school"]
Traceback (most recent call last):
File "<pyshell#152>", line 1, in <module>
student1["school":"sawlwan public school"]
TypeError: unhashable type: 'slice'
>>> student1["school"]="sawlwan public school"
>>> del [age]
Traceback (most recent call last):
File "<pyshell#154>", line 1, in <module>
del [age]
NameError: name 'age' is not defined
>>> del student1 ["age"]
>>> {studen1}
Traceback (most recent call last):
File "<pyshell#156>", line 1, in <module>
{studen1}
NameError: name 'studen1' is not defined
>>> {student1}
Traceback (most recent call last):
File "<pyshell#157>", line 1, in <module>
{student1}
TypeError: unhashable type: 'dict'
>>> dict{studen1}
SyntaxError: invalid syntax
>>> dict student1
SyntaxError: invalid syntax
>>> dict [student]
Traceback (most recent call last):
File "<pyshell#160>", line 1, in <module>
dict [student]
TypeError: 'type' object is not subscriptable
>>> dict [student1]
Traceback (most recent call last):
File "<pyshell#161>", line 1, in <module>
dict [student1]
TypeError: 'type' object is not subscriptable
>>> dict[student1}
SyntaxError: invalid syntax
>>> dict[student1]
Traceback (most recent call last):
File "<pyshell#163>", line 1, in <module>
dict[student1]
TypeError: 'type' object is not subscriptable
>>> dict
<class 'dict'>
>>> student1
{'name': 'hitesh', 'school': 'sawlwan public school'}
>>> student1
{'name': 'hitesh', 'school': 'sawlwan public school'}
>>> student.key()
Traceback (most recent call last):
File "<pyshell#167>", line 1, in <module>
student.key()
AttributeError: 'str' object has no attribute 'key'
>>> studen1.keys()
Traceback (most recent call last):
File "<pyshell#168>", line 1, in <module>
studen1.keys()
NameError: name 'studen1' is not defined
>>> student1.keys()
dict_keys(['name', 'school'])
>>> student1.value()
Traceback (most recent call last):
File "<pyshell#170>", line 1, in <module>
student1.value()
AttributeError: 'dict' object has no attribute 'value'
>>> student1.values()
dict_values(['hitesh', 'sawlwan public school'])
>>> type(student1)
<class 'dict'>
>>> len(student1)
2
>>> student1["age"]=16
>>> student1
{'name': 'hitesh', 'school': 'sawlwan public school', 'age': 16}
>>> del ["age"}
SyntaxError: invalid syntax
>>> del ["age"]
SyntaxError: can't delete literal
>>> del{"age"}
SyntaxError: can't delete literal
>>> del["age"]
SyntaxError: can't delete literal
>>> del student1 ["age"]
>>> student1
{'name': 'hitesh', 'school': 'sawlwan public school'}
>>> lenstudent1
Traceback (most recent call last):
File "<pyshell#182>", line 1, in <module>
lenstudent1
NameError: name 'lenstudent1' is not defined
>>> len[student1]
Traceback (most recent call last):
File "<pyshell#183>", line 1, in <module>
len[student1]
TypeError: 'builtin_function_or_method' object is not subscriptable
>>> len(student1)
2
>>> student1.values()
dict_values(['hitesh', 'sawlwan public school'])
>>> student1.keys()
dict_keys(['name', 'school'])
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> student2=("school":"mamta modern")
SyntaxError: invalid syntax
>>> student2={"school":"mamta modern"}
>>> student1.update=(student2)
Traceback (most recent call last):
File "<pyshell#201>", line 1, in <module>
student1.update=(student2)
AttributeError: 'dict' object attribute 'update' is read-only
>>> tudent1.update=[tudent2]
Traceback (most recent call last):
File "<pyshell#202>", line 1, in <module>
tudent1.update=[tudent2]
NameError: name 'tudent2' is not defined
>>> student1.update=[student2]
Traceback (most recent call last):
File "<pyshell#203>", line 1, in <module>
student1.update=[student2]
AttributeError: 'dict' object attribute 'update' is read-only
>>> student1.update={student2}
Traceback (most recent call last):
File "<pyshell#204>", line 1, in <module>
student1.update={student2}
TypeError: unhashable type: 'dict'
>>> student1.update[student2]
Traceback (most recent call last):
File "<pyshell#205>", line 1, in <module>
student1.update[student2]
TypeError: 'builtin_function_or_method' object is not subscriptable
>>> student1.update{student2}
SyntaxError: invalid syntax
>>> student1.update(student2)
>>> student1
{'name': 'hitesh', 'school': 'mamta modern'}
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> del{student2}
SyntaxError: can't delete literal
>>> del student2["school"]
>>> student2
{}
>>> student1
{'name': 'hitesh', 'school': 'mamta modern'}
>>> del student2
>>> student2
Traceback (most recent call last):
File "<pyshell#225>", line 1, in <module>
student2
NameError: name 'student2' is not defined
>>> tuple1=("raju","neetu","geeta",1,2,3)
>>> 1
1
>>> 2
2
>>> 3
3
>>> 4
4
>>> 5
5
>>> 5
5
>>> 6
6
>>> 7
7
>>> 8
8
>>> 9
9
>>> 0
0
>>> 1
1
>>> 11
11
>>> 22
22
>>> 33
33
>>> 44
44
>>> 55
55
6
>>> 66
66
>>> 77
77
>>> 88
88
>>> 99
99
>>> 101010101010
101010101010
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> tuple1
('raju', 'neetu', 'geeta', 1, 2, 3)
>>> tuple2=tuple1[0:3]
>>> tuple2
('raju', 'neetu', 'geeta')
>>> tuple2=tuple1[1:2]
>>> tuple2
('neetu',)
>>> tuple2=tuple1[1:3]
>>> tuple2
('neetu', 'geeta')
>>> tuple1=tuple2
>>> tuple1
('neetu', 'geeta')
>>> tuple2
('neetu', 'geeta')
>>> tuple1[3]
Traceback (most recent call last):
File "<pyshell#275>", line 1, in <module>
tuple1[3]
IndexError: tuple index out of range
>>> tuple1[1]
'geeta'
>>> tuple1[1]="xyz"
Traceback (most recent call last):
File "<pyshell#277>", line 1, in <module>
tuple1[1]="xyz"
TypeError: 'tuple' object does not support item assignment
>>> tuple1[2]
Traceback (most recent call last):
File "<pyshell#278>", line 1, in <module>
tuple1[2]
IndexError: tuple index out of range
>>> tuple1
('neetu', 'geeta')
>>> tuple1[0]
'neetu'
>>> tuple[1]
Traceback (most recent call last):
File "<pyshell#281>", line 1, in <module>
tuple[1]
TypeError: 'type' object is not subscriptable
>>> tuple1[1]
'geeta'
>>> neetu iin tuple1
SyntaxError: invalid syntax
>>> neetu in tuple1
Traceback (most recent call last):
File "<pyshell#284>", line 1, in <module>
neetu in tuple1
NameError: name 'neetu' is not defined
>>> "neetu" in tuple1
True
>>> tuple2
('neetu', 'geeta')
>>> tuple2+tuple1
('neetu', 'geeta', 'neetu', 'geeta')
>>> tuple1/tuple2
Traceback (most recent call last):
File "<pyshell#288>", line 1, in <module>
tuple1/tuple2
TypeError: unsupported operand type(s) for /: 'tuple' and 'tuple'
>>> tuple1*tuple2
Traceback (most recent call last):
File "<pyshell#289>", line 1, in <module>
tuple1*tuple2
TypeError: can't multiply sequence by non-int of type 'tuple'
>>> tuple1-tuple2
Traceback (most recent call last):
File "<pyshell#290>", line 1, in <module>
tuple1-tuple2
TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'
>>> tuple3=ramesh
Traceback (most recent call last):
File "<pyshell#291>", line 1, in <module>
tuple3=ramesh
NameError: name 'ramesh' is not defined
>>> tuple3=("ramesh")
>>> tuple1+tuple3
Traceback (most recent call last):
File "<pyshell#293>", line 1, in <module>
tuple1+tuple3
TypeError: can only concatenate tuple (not "str") to tuple
>>> tuple3
'ramesh'
>>> tuple2+tuple3
Traceback (most recent call last):
File "<pyshell#295>", line 1, in <module>
tuple2+tuple3
TypeError: can only concatenate tuple (not "str") to tuple
>>> tuple1
('neetu', 'geeta')
>>> tuple2
('neetu', 'geeta')
>>> tuple3
'ramesh'
>>> tuple2+tuple3
Traceback (most recent call last):
File "<pyshell#299>", line 1, in <module>
tuple2+tuple3
TypeError: can only concatenate tuple (not "str") to tuple
>>> tuple3=("xyz",)
>>> tuple2+tuple3
('neetu', 'geeta', 'xyz')
>>> tuple1+tuple2+tuple3=tuple4
SyntaxError: can't assign to operator
>>> tuple1+tuple2
('neetu', 'geeta', 'neetu', 'geeta')
>>> tuple1+tuple2+tuple3*10
('neetu', 'geeta', 'neetu', 'geeta', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz', 'xyz',
'xyz', 'xyz', 'xyz', 'xyz')
>>>