Python 2.7.12 (v2.7.12:d33e0cf91556, June 2016, 15:19:22) [MSC v.1500 bit (Intel)] on Win32 Type ' copyright ', "credit
S "or" license () for the more information.
>>> 4.5 and 4.6 4.6 >>> 3.2 and-4.5-4.5 >>> 3.2 and ( -4.5) -4.5 >>> ( -2.3) and (-6.1) -6.1 >>>-(2.3) and ( -6.1) -6.1 >>>-((2.3) and ( -6.1)) 6.1 >>> 4.5 &3.4 traceback (Most RE Cent call last): File "<pyshell#6>", line 1, in <module> 4.5 &3.4 typeerror:unsupported operand typ E (s) for: ' Float ' and ' float ' >>> 4.3>>2 traceback (most recent called last): File "<PYSHELL#7&G t; ", line 1, into <module> 4.3>>2 typeerror:unsupported operand type (s) for >>: ' float ' and ' int ' ;>> random.random () traceback (most recent call last): File ' <pyshell#8> ', line 1, in <module> R Andom.random () nameerror:name ' random ' is not defined >>> import random >>> Random.randOm () 0.7720802147573392 >>> Choice () Traceback (most recent call last): File ' <pyshell#11> ', line 1, in <module> choice () nameerror:name ' Choice ' is not defined >>> Random.choice () traceback (most recent Call last): File "<pyshell#12>", line 1, in <module> Random.choice () Typeerror:choice () takes exactly 2 arguments (1 given) >>> Random.choice (2.3,4.5) Traceback (most recent call last): File "<pyshell#13>" , line 1, in <module> random.choice (2.3,4.5) Typeerror:choice () takes exactly 2 arguments (3 given) >>> ; Random.choice (2,4) Traceback (most recent call last): File ' <pyshell#14> ', line 1, in <module> random. Choice (2,4) Typeerror:choice () takes exactly 2 arguments (3 given) >>> Random.choice (5) Traceback (most recent Call last): File "<pyshell#15>", line 1, in <module> random.choice (5) file "C:\Python27\lib\random.py ", line 275, in choice
Return Seq[int (Self.random () * len (seq))] # raises indexerror if Seq is empty typeerror:object of type ' int ' has no
Len () >>> random.choice (' Hellowi ') ' W ' >>> Random.randint (2,9) 3 >>> random.random () 0.8852638844287753 >>> Random.randint () traceback (most recent call last): File ' <pyshell#19> ', line 1, In <module> Random.randint () Typeerror:randint () takes exactly 3 arguments (1 given) >>> Random.randi NT () Traceback (most recent call last): File ' <pyshell#20> ', line 1, in <module> random.randint () Type
Error:randint () takes exactly 3 arguments (1 given) >>> Random.randint (9) Traceback (most recent call last): File "<pyshell#21>", line 1, in <module> random.randint (9) Typeerror:randint () takes exactly 3 arguments (2 given) >>> Random.randint (1,56) 4 >>> random.randrange (1,5) 3 >>> random.uniform (2,9) 4.73 764451150299 >>> a=raw_inPut (' Shuru ') shuru200.3 >>> a ' 200.3 ' >>> a=int (raw_input (' Shuru ')) shuru200.3 Traceback (most recent Call last): File "<pyshell#27>", line 1, in <module> a=int (raw_input (' Shuru ')) valueerror:invalid liter Al for Int () with base: ' 200.3 ' >>> print eval (' 1+1 ') 2 >>> print eval (' Hello ') traceback (most rec ENT call last): File "<pyshell#29>", line 1, in <module> print eval (' hello ') file "<string>", Li
NE 1, in <module> nameerror:name ' hello ' are not defined >>> print eval (' 3.4 ') 3.4 >>> import sys >>> sys.maxint 2147483647 >>> sys.maxlong traceback (most recent call last): File "<pyshell#33> ; ", line 1, in <module> sys.maxlong attributeerror: ' Module ' object has no attribute ' Maxlong ' >>> dir ( SYS) [' __displayhook__ ', ' __doc__ ', ' __excepthook__ ', ' __name__ ', ' __package__ ', ' __stderr__ ', ' __stdin__ ', ' __stdout_ _ ', ' _clear_type_cache ', ' _cUrrent_frames ', ' _getframe ', ' _mercurial ', ' api_version ', ' argv ', ' builtin_module_names ', ' byteorder ', ' call_tracing ' , ' callstats ', ' copyright ', ' displayhook ', ' dllhandle ', ' dont_write_bytecode ', ' exc_clear ', ' exc_info ', ' exc_ Traceback ', ' exc_type ', ' exc_value ', ' excepthook ', ' exec_prefix ', ' executable ', ' exit ', ' flags ', ' float_info ', ' Float_ Repr_style ', ' getcheckinterval ', ' getdefaultencoding ', ' getfilesystemencoding ', ' getprofile ', ' getrecursionlimit ', ' Getrefcount ', ' getsizeof ', ' gettrace ', ' getwindowsversion ', ' hexversion ', ' last_traceback ', ' last_type ', ' Last_value ' , ' Long_info ', ' maxint ', ' maxsize ', ' maxunicode ', ' meta_path ', ' modules ', ' path ', ' path_hooks ', ' path_importer_cache ', ' Platform ', ' prefix ', ' py3kwarning ', ' setcheckinterval ', ' setprofile ', ' setrecursionlimit ', ' settrace ', ' stderr ', ' StdIn ', ' stdout ', ' subversion ', ' Version ', ' Version_info ', ' warnoptions ', ' winver '] >>> a=1 >>> while T Ype (a) = = Type (1): a*=2 maxint = A-1 File <pyshell#38> ", line 4 maxint = A-1 ^ Indentationerror:unindent does not match no outer indentation level ;>> a=1 >>> while type (a) = = Type (1): a*=2 >>> maxint=a >>> minint=-a >>> Max
Int=a-1 >>> print maxint,minint 0-1 >>> a=1 >>> while type (a) ==int:a*=2 maxint=a-1 File "<pyshell#47>", line 4 maxint=a-1 ^ indentationerror:unindent does not match any outer Inde Ntation level >>> >>> a=1 >>> while type (a) ==int:a*=2 syntaxerror:invalid syntax >> > A=1 >>> while type (a) = = int:a*=2 >>> maxint = A-1 >>> minint =-a >>> prin T maxint,minint 2147483647-2147483648 >>> 9.0/5.9 1.5254237288135593 >>> a= ' Hello ' >>> type ( a) <type ' str ' > >>> a=u ' Hello ' >>> type (a) <type ' Unicode ' > >>> #-*-coding:utf-8- *->>> type (' HellO ') <type ' str ' > >>> a= ' hello ' >>> b= ' world ' >>> ls=[a,b] >>> ls [' hello ', ' worl
d '] >>> join (LS) traceback (most recent call last): File "<pyshell#67>", line 1, in <module> Join (LS) nameerror:name ' join ' isn't defined >>> join (a,b) Traceback (most recent call last): File "<pys
Hell#68> ", line 1, in <module> join (a,b) Nameerror:name ' join ' are not defined >>> a= ' Sthirnghello ' >>> a[-1:-9] ' >>> a[-9:-1] ' Irnghell ' >>> a[-1] ' o ' >>> a[-9:0 ' ' >>> a[-9 : -1] ' Irnghell ' >>> a[-9:] ' Irnghello ' >>> a[-2:] ' lo ' >>> a[' syntaxerror:invalid syntax > >> a[:] ' sthirnghello ' >>> ' Hello World python ' [ -100:100] ' Hello World python ' >>> a[-9:-1] ' Irngh Ell ' >>> A[-len (a): -1] ' Sthirnghell ' >>> A[:-len (a)] ' >>> A[:-len (a) +1] ' s ' >>> a[n One] Traceback (most RECent call last): File "<pyshell#84>", line 1, in <module> A[none] typeerror:string indices must to be inte Gers, not nonetype >>> a= ' Hello python ' >>> to I in [None] + range ( -1,-len (a), -1): print a[:i] Hel Lo python Hello pytho hello pyth hello pyt hello py hello hell hel he h >>> b=[none].extend (range (
-1,-len (a), -1)) >>> b >>> B >>> print b None >>> str ([1,2, ' hello ']) "[1, 2, ' Hello ']" >>> a=[1,2,3] >>> list (a) [1, 2, 3] >>> ID (a) 51009256 >>> ID (list (a)) 51007776 >&G
T;> a=[1,2,3] >>> b=list (a) >>> A is B False >>> ID (a) 51008896 >>> ID (b) 51015848
>>> a=[1,2,3] >>> b=a >>> A is b True >>> b.append (MB) >>> A [1, 2, 3, 100] >>> b [1, 2, 3, M] >>> c=123 >>> d=123 >>> A is D False >>> c is D True ;>> e=[1,2,3] >>> b=[1,2,3] >>> e is b False >>> f=e >>> e-F True >>>