#!/usr/bin/env python # -*- coding: utf-8 -*- # use case 1: the first python program print "hello world"; # use case 2: the second python program : use keyword :for for i in range(10): print str(i)+"hello worldww"; print "add"; # use case 3: the second python program : use keyword for (2. write mult lines) for i in range(10): print str(i)+"hello worldww"; print "add"; # use case 4: multLine annotation ''' print "multline "; ''' #use case 5: pint a string of string print "hello world " , "secod string " ,"third string "; #use case 6 : print calulate print '3+5 =' , 3+5 ; #use case 7: input a string ''' name = raw_input(); print 'the name is value :',name ; #use case 8: input a string with information name = raw_input('please input a name'); print 'the name is value :',name ; ''' #use case 9: print absolute value of a integer (use the key word of if ) a=100 if a>=0: print a; else: print -a; #use case 10: print ' or "" print '\"i\'m enjoy pthon \"'; #use case 11 : use + x = 100; x = x+300; print x; x ="a string"; print x; #use case 12: about int and float print 10/3; print 10.0/3; print 10%3; print 10.0%3; #use case 13: out of range of variable b ='B'; b = 65574; # haven't out of range . good ! b = 898888888; print b ; #use case 14: ACSII code ,UNICODE ''' #!/usr/bin/env python # -*- coding: utf-8 -*- ''' print ord('T'),chr(100) , unicode('T'), len('hello'),len(unicode('hello')),len(unicode("你好".decode('utf-8'))) , "你好"; #use case 15 , connect string print "the nuber i want to enter is %d , the name of mine is %s"%(7 , "liujie");