Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
num=input(enter a number)
If num>1:
For i in range (2,num):
If num % i ==0:
Print (num,is not a prime number)
Break
Else:
Print(num,is a prime number)
print("1: ADDITION")
print("2: SUBTRACTION")
print("3: MULTIPLICATION")
print("4: DIVISION")
if CHOICE == "1":
a = input("Enter the value of a:")
b = input("Enter the value of b:")
c=a+b
print c
else:
print "Invalid Number"
import calendar
yy = int(input("Enter year: "))
mm = int(input("Enter month: "))
Print calendar.month(yy,mm)
#program to accept the principle,rate and interest from the user and
calculate simple interest.
P=input(enter the principle:)
R=input(enter the rate:)
#program to accept radius from user and calculate perimeter and area.
Printto calculate perimeter and area
r=input(enter radius:)
Print area is,3.14*r*
Print perimeter is, 2*3.14*r
elif(c==2):
l = input("enter length")
b = input("enter breadth")
a = l*b
print"Area = ",a
elif(c==3):
x = input("enter first side of triangle")
y = input("enter second side of triangle")
z = input("enter third side of triangle")
s = (x+y+z)/2
A = ((s-x)*(s-y)*(s-z))**0.5
print"Area=",A
else:
print "Wrong input"
# program to print all the natural numbers up to a given number.
n = input("enter any number")
for i in range(1,n+1):
print i,
n = n/10
print "reverse number is", r
s=[]
def push(self):
a=input("Enter any Number:")
stack.s.append(a)
def display(self):
l=len(stack.s)
if (l==0):
print "Stack Is Empty!"
else:
for i in range(l-1,-1,-1):
print stack.s[i]
a=stack()
c="y"
while(c=="y"):
print "1.PUSH"
print "2.POP"
print "3.DISPLAY"
print "4.EXIT"
choice=input("Enter your choice:")
if (choice==1):
a.push()
elif(choice==2):
if(a.s==[]):
print "Stack Empty"
else:
print "Deleted Element is:",a.s.pop()
elif(choice==3):
a.display()
elif(choice==4):
print "Exiting the program"
else:
print ("Wrong input")
c=raw_input("Do you want to continue?(y/n)")
#eligible to vote or not
age=input("enter your age:")
if age>=18:
print "Eligible to vote"
else:
print "Not eligible to vote"
for i in range(1,m+1):
for j in range(1,n+1):
print j,
Print