Write a program to display numbers in descending order in the step of 5 starting from 100 python code example
Example 1: how to print numbers between two numbers in pythom
items = []
for i in range(100, 401):
s = str(i)
if (int(s[0])%2==0) and (int(s[1])%2==0) and (int(s[2])%2==0):
items.append(s)
print( ",".join(items))
Example 2: Write a program to display numbers in descending order in the step of 5 starting from 100 python
# Python program to print numbers
# from n to 1
# input the value of n
n = int(input("Enter the value of n: "))
# check the input value
if (n<=1):
print "n should be greater than 1"
exit()
# print the value of n
print "value of n: ",n
# print the numbers from n to 1
# message
print "numbers from {0} to {1} are: ".format(n,1)
# loop to print numbers
for i in range(n,0,-1):
print i