dLimit = 500
iNo = int(raw_input("Specify Quantity : "))
dUnitPrice = float(raw_input("Specify Unit Price : "))
dGross = iNo * dUnitPrice
if(dGross > dLimit):
dDisc = 10
else:
dDisc = 0;
dNet = (100 - dDisc) * dGross / 100
print "Total Price : %d" % dNet
dNo1 = int(raw_input("Enter Number 1 : "))
dNo2 = int(raw_input("Enter Number 2 : "))
print "1. Greatest"
print "2. Least"
print "3. Average"
iOpt = int(raw_input("Select : "))
if iOpt == 1:
if dNo1 > dNo2:
print dNo1
else:
print dNo2
print " is the greatest"
elif iOpt == 2:
if dNo1 < dNo2:
print dNo1
else:
print dNo2
print " is the least"
elif iOpt == 3:
print "The average is : " , (dNo1 + dNo2)/2
else:
print "wrong Choice"
iLimit = int(raw_input("Enter limit : "))
iSum = 0
for i in range(1,iLimit+1):
iSum = iSum + i
print "The Sum Is : " , iSum
print "Calculation Of Product"
for i in range(1,37):
for j in range(1,37):
if (i * j) == 36:
print i , " and " , j
import random
iRoll = 0
iNoOfRolls = 0
while iRoll != 6:
iRoll = random.randint(1,200) % 6 + 1
iNoOfRolls = iNoOfRolls + 1
print iNoOfRolls
# Do while concept is not in python thats way the program is implemented using WHILE
import random
iRoll = 0
iNoOfRolls = 0
while iRoll != 6:
iRoll = random.randint(1,200) % 6 +1
iNoOfRolls = iNoOfRolls + 1
print iNoOfRolls
import random
iCounter = 0
iRoll1 = random.randint(1,200) % 6 + 1
iRoll2 = random.randint(1,200) % 6 + 1
while iRoll1 != iRoll2:
iRoll1 = random.randint(1,200) % 6 + 1
iRoll2 = random.randint(1,200) % 6 + 1
iCounter = iCounter + 1
print "The rolls were = " , iRoll1
print "Number of attempts = " , iCounter
iSum = 0
i = 0
iNo = raw_input("Enter a number : ")
while iNo.isdigit():
iSum = iSum + int(iNo)
i = i + 1
iNo = raw_input("Enter one more number : ")
print "Average = " , (float)((iSum)/i)
import random
iNO = 0
for i in range(1,14):
iNo = random.randint(1,200) % 3
if iNo == 0:
print "1"
elif iNo == 1:
print "X"
elif iNO == 2:
print "2"
iNo = 0
iRoot = 1
while iNo < 2 and iRoot <=100:
LP = iRoot * (iRoot - 6) * (iRoot + 8)
if LP == 0:
iNo = iNo + 1
print iRoot
iRoot = iRoot + 1
import math
while 1 == 1:
dNo = int(raw_input("Enter a number : "))
if dNo <= 0:
break
print "The square root of the number is ",math.sqrt(dNo)