Python Help

psan550

Member
May 10, 2008
68
1
0
Veyangoda
Machanz Python danna ekek me question 2ta anzer deepanko.
Loku help ekak!!!


1)write a python programme which asks for a positive integer and prints all positive integers that perfectly devide the Given Number.

2)Write a python programme which generates a positive integer between 0 and 20 (Suppose the generated Integer is 'M') and calculate the product 1x2x3x4x5........x(M-1)xM and prints the value of the product

3)write a python Program which prints the numbers between 1 and 2000 in the following manner.
2,4,6,8,.........................2000

Thankuuu :)
 

Rated R

Member
Dec 8, 2011
13
1
0
1 weni eka hari machan
code eka :

a= int(raw_input('please enter a positve integer: '))
b = 1

while b <= a:
if a%b == 0:
print(b)
b += 1
 

Rated R

Member
Dec 8, 2011
13
1
0
machan 2nd eke code eka:

import random
M= random.randint(0,20)
print('This is the M: %d'%M)
b = 1
product = 1
while b <= M:
product = product * b

b += 1

if M == 0:
print(0)
else:
print(product)

machan tab gahala indentation hadaganin methana paste karapuwama ewa wenas wenawa