print 'Every age has a language of its own\n' #print the statement
var1 = 20 #define var1 and assign value to it
var2 = var1 + 10 #assign value to var2
print 'var1+10 is', #output text
print var2, '\n' #output value of var2
charvar1 = 'A' #define a character type variable
charvar2 = '\t' #define a character variable as tab
print charvar1, #display character
print charvar2, #display character
charvar1 = 'B' #set character variable to character constant
print charvar1, #display character
print '\n'
ftemp = input("Enter temperature in fahrenheit: ") #take temperature in fahrenheit from user
ctemp = (ftemp-32) * 5 / 9 #calculating temprature in Celsius
print 'Equivalent in Celsius is:', ctemp, '\n' #deisplay temprature in Celsius
PI = 3.14159 #float type variable
rad = input("Enter radius of circle: ") #get radius from user
area = PI * rad * rad #find area of circle
print 'Area is',area,'\n' #display area
#define the variables
pop1 = 2425785
pop2 = 47
pop3 = 9761
print 'LOCATION POP.\nPortcity',pop1,'\nHightown',pop2,'\nLowvilla',pop3,'\n' #display all variables
#define the variables
pop1 = 2425785
pop2 = 47
pop3 = 9761
print 'LOCATION %12s \nPortcity %12d \nHightown %12d \nLowville %12d \n' % ('POPULATION', pop1, pop2, pop3)
from ctypes import c_int,c_uint
signedVar = c_int(1500000000) #sigened
unsignVar = c_uint(1500000000) #unsigned
signedVar.value = signedVar.value * 2
signedVar.value = signedVar.value / 3 #calculate exceeds range
unsignVar.value = (unsignVar.value * 2) / 3 #calculate within range
print 'signedVar =',signedVar.value #wrong
print 'unsignVar =',unsignVar.value #ok
#define variables
count = 7
avgWeight = 155.5
totalWeight = count * avgWeight #calculate total weight
print 'totalWeight =',totalWeight,'\n' #print total weight
from ctypes import c_int
intVar = c_int(1500000000)
intVar.value = intVar.value * 10
intVar.value = intVar.value/10 #result too large
print 'intVar =',intVar.value,'\n', #wrong answer
intVar = 1500000000
intVar = (intVar * 10) / 10;
print 'intVar =',intVar,'\n' #right answer
print 6%8,'\n',7%8,'\n',8%8,'\n',9%8,'\n',10%8,'\n'
ans = 27 #define ans variable
ans += 10 #same as: ans = ans + 10
print ans,',',
ans -= 7 #same as: ans = ans - 7
print ans,',',
ans *= 2 #same as: ans = ans * 2
print ans,',',
ans /= 3 #same as: ans = ans / 3
print ans,',',
ans %= 3 #same as: ans = ans % 3
print ans,'\n'
#The ++ operator is not available in Python
count = 10
print 'count =',count
count += 1 #work as prefix
print 'count =',count
print 'count =',count
print 'count =',count
count += 1 #work as postfix
print 'count =',count
from math import sqrt #import for srt()
number = input("Enter the number: ") #get the number
answer = sqrt(number) #find square root
print 'Square root is',answer,'\n' #display it