#Variable declaration
count = 1
pr = [1000,2000,3500]
yr = [5,5,5]
intr = [13.5,13.5,3.5]
# while loop
while count <= 3:
#Input from the user
#p,n,r = raw_input("Enter values of p, n and r : ").split()
p = pr[count-1] # principle
n = yr[count-1] # number of years
r = intr[count-1]# rate of interest
#Calculation
si = p * n * r / 100 ; #formula for simple interest
#Result
print "Simple interest = Rs.",si
#Increment count
count = count + 1
pr = [1000,2000,3500]
yr = [5,5,5]
intr = [13.5,13.5,3.5]
#for loop
for count in range(1, 4):
#Input from the user
#p,n,r = raw_input("Enter values of p, n and r : ").split()
p = pr[count-1] # principle
n = yr[count-1] # number of years
r = intr[count-1]# rate of interest
#Calculation
si = p * n * r / 100 ; #formula for simple interest
#Result
print "Simple interest = Rs.",si
#nested for loops
for r in range(1,4): #outer loop
for c in range(1,3): #inner loop
s = r + c #find the sum
print "r = %d c = %d sum = %d" % (r, c, s) #Display result
#do while loop
while True:
#num = raw_input("Enter a number: ")
num = 11
print "square of %d is %d"%(num, num * num )
print "Want to enter another number y/n: "
another = 'n'
print another
if another == 'y':
continue
else:
break
#Variable declaration
another = 'y'
#do while loop
import sys
for i in range(1,10000): #infinte loop
#num = raw_input("Enter a number: ")
num = 11
print "square of %d is %d"%(num, num * num )
print "Want to enter another number y/n: "
another = 'n'
print another
if another == 'y':
continue
else:
break
#Variable declaration
another = 'y'
#do while loop
while another == 'y':
#num = raw_input("Enter a number: ")
num = 11
print "square of %d is %d"%(num, num * num )
print "Want to enter another number y/n: "
another = 'n'
print another
#Input from user
#num = raw_input("Enter a number: ")
num = 11
#Variable declaration
i = 2
#while loop
while i <=(num - 1):
if num % i == 0:
print "Not a prime number" #Display if not prime number
break
i += 1
#Display if prime number
if i == num:
print "Prime number"
#Variable declaration
i = 1
j = 1
#while loops
while i <= 100 : #outer loop
i = i+1
while j <= 200 : #inner loop
j = j+1
if j == 150:
break #break statement in inner loop
else:
print i, j
#for loops
for i in range(1,3):
for j in range(1,3):
if i==j :
continue # continue statement
print i , j