Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 14:13:39) [GCC 4.0.1 (Apple Inc. build 5493)] Type "help", "copyright", "credits" or "license" for more information. >>> string Traceback (most recent call last): File "", line 1, in NameError: name 'string' is not defined >>> "string" 'string' >>> 'string' 'string' >>> 'string" Traceback (most recent call last): File "", line 1, in EOL while scanning string literal: , line 1, pos 8 >>> 'strin g6666 ;!' 'strin g6666 ;!' >>> 'strin g6666 ;!' '666' 'strin g6666 ;!666' >>> 'strin g6666 ;!' + '666' 'strin g6666 ;!666' >>> Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 14:13:39) [GCC 4.0.1 (Apple Inc. build 5493)] Type "help", "copyright", "credits" or "license" for more information. >>> [evaluate untitled-1.py] >>> x 'aaaadddd' >>> 'strin g6666 ;!' + '666' 'strin g6666 ;!666' >>> 'strin g6666 ;!' * '666' Traceback (most recent call last): File "", line 1, in TypeError: can't multiply sequence by non-int of type 'str' >>> 'strin g6666 ;!' - '666' Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for -: 'str' and 'str' >>> 'strin g6666 ;!' / '666' Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for /: 'str' and 'str' >>> 'strin g6666 ;!' /% '666' Traceback (most recent call last): File "", line 1, in invalid syntax: , line 1, pos 20 >>> 'strin g6666 ;!' % '666' Traceback (most recent call last): File "", line 1, in TypeError: not all arguments converted during string formatting >>> 'strin g6666 ;!' ** '666' Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'str' >>> 'strin g6666 ;!' * 6 'strin g6666 ;!strin g6666 ;!strin g6666 ;!strin g6666 ;!strin g6666 ;!strin g6666 ;!' >>> ''' hhh''' ' hhh' >>> >>> >>> >>> >>> x = 'a' >>> x == 'a' True >>> x < 'b' True >>> x < 'aa' True >>> x < 'B' False >>> x < '!' False >>> x < ',' False >>> x < '' False >>> "" '' >>> 'cat' in 'cataract' True >>> 'cat' in 'cart' False >>> ''' ... ... ... ... print 15 ... this is a string ... ''' '\n\n\n\nprint 15\nthis is a string\n' >>> x = ''' ... ... ... ... things ... ... more things''' >>> x '\n\n\n\nthings\n\nmore things' >>> print x things more things >>> "jmhghjg Traceback (most recent call last): File "", line 1, in EOL while scanning string literal: , line 1, pos 9 >>> z = "jmhghjg" >>> z = "jmhgh\njg" >>> z 'jmhgh\njg' >>> z = "jmhgh/njg" >>> z = "jmhgh\njg" >>> print x things more things >>> print z jmhgh jg >>> >>> >>> >>> >>> z = "jmhg\\h\njg" >>> z 'jmhg\\h\njg' >>> print z jmhg\h jg >>> z = "jmhg"h\njg" Traceback (most recent call last): File "", line 1, in invalid syntax: , line 1, pos 11 >>> z = "jmhg\"h\njg" >>> print z jmhg"h jg >>> z = "jmhg\'h\njg" >>> print z jmhg'h jg >>> "asdas'asdasas" "asdas'asdasas" >>> '"' '"' >>> z = "jm\thg\'h\njg" >>> print z jm hg'h jg >>> ord ('a') 97 >>> chr(97) 'a' >>> chr(ord('a')) 'a' >>> x = 'r' >>> ord(x) - ord('a') + 1 18 >>> x + ord('a') + 1 Traceback (most recent call last): File "", line 1, in TypeError: cannot concatenate 'str' and 'int' objects >>> x = 14 >>> chr(x + ord('a')) 'o' >>> len('') 0 >>> len('sfgsd') 5 >>> bool('') False >>> bool('ss') True >>> str(12) '12' >>> str(12.8587) '12.8587' >>> int('12343242') 12343242 >>> int('101010101') 101010101 >>> int('0xFFFF') Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '0xFFFF' >>> int('10101.0101') Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '10101.0101' >>> float('10101.0101') 10101.0101 >>> float('101010101') 101010101.0 >>> age = '12' >>> print "My age is %d" My age is %d >>> print "My age is %d" % Traceback (most recent call last): File "", line 1, in invalid syntax: , line 1, pos 23 >>> print "My age is %d" % age Traceback (most recent call last): File "", line 1, in TypeError: %d format: a number is required, not str >>> age = 12 >>> print "My age is %d" % age My age is 12 >>> height = 188 Traceback (most recent call last): File "", line 1, in IndentationError: unexpected indent (, line 1) >>> height = 188 >>> weight = 170 >>> name = 'Marek' >>> print "My age is %d, my height is %d, my weight is %d, my name is %s" % (age,height, 170,'Marek') My age is 12, my height is 188, my weight is 170, my name is Marek >>> >>> >>> print 'My height is %s %s %s' % ('%s', 170, '%s') My height is %s 170 %s >>> print 'My height is \%s %s \%s' % 170 Traceback (most recent call last): File "", line 1, in TypeError: not enough arguments for format string >>> print 'My height is \%s %s \%s' % ('n', 170, 'n') My height is \n 170 \n >>> >>> >>> >>> >>> >>> raw_input() gfgjjhghghgjjhghjgghjhjg 'gfgjjhghghgjjhghjgghjhjg' >>> x = raw_input() lskjhfkjlhsflkdjd >>> x 'lskjhfkjlhsflkdjd' >>> x = raw_input("Please input something") Please input somethingsdflsjhfkjshdfkjshfjlds >>> x 'sdflsjhfkjshdfkjshfjlds' >>> x = raw_input("Please input something: ") Please input something: hhhhhh >>> x = raw_input("Please input something: ") Please input something: 555555 >>> type(x) >>>