avg = 346
per = 69.2
#Result
print "Average = %d\nPercentage = %f" %(avg, per )
weight = 63
#Result
print "weight is %d kg" %( weight )
print "weight is %2d kg"%( weight )
print "weight is %4d kg" %( weight )
print "weight is %6d kg" %(weight )
print "weight is %-6d kg" %( weight )
firstname1 = "Sandy"
surname1 = "Malya"
firstname2 = "AjayKumar"
surname2 = "Gurubaxani"
#Result
print "%20s%20s" %( firstname1, surname1 )
print "%20s%20s" %(firstname2, surname2 )
print "You\tmust\tbe\tcrazy\nto\thate\tthis\tbook"
ch = 'z'
i = 125
a = 12.55
s = "hello there !"
#Result
print "%c %d %f" %( ch, ord(ch), ord(ch ))
print "%s %d %f"%( s, ord(s[1]), ord(s[1]) )
print "%c %d %f"%(i ,i, i )
print "%f %d\n"%( a, a )
i = 10
ch = 'A'
a = 3.14
#Result
print "%d %c %f" %(i, ch, a )
str = "%d %c %f" %(i, ch, a ) #sprintf
print "%s" %(str )
import msvcrt
print "Press any key to continue"
#msvcrt.getch( ) # will not echo the character
print "Type any character"
#ch = msvcrt.getche( ) # will echo the character typed
ch = 'A'
print ch
#ch = input("Type any character")#getchar( ) will echo character, must be followed by enter key
print "Type any character"
ch = 8
print ch
#ch = input( "Continue Y/N" ) #fgetchar( ) will echo character, must be followed by enter key
print "Continue Y/N"
ch = 'N'
print ch
ch = 'A'
#Result
print ch #putch
print ch #putchar
print ch #fputchar
print 'Z' #putch
print 'Z' #putchar
print 'Z' #fputchar
print "Enter name"
footballer = "Jonty Rhodes"
print footballer
#Result
print "Happy footballing!"
print footballer