Question #3163

Program to print a to z characters using for loop?

Expert's answer

x=input('set integer x:')

y=input('set integer y:')

if y<x:

z=y

y=x

x=z

z=0

for i in range(y-x-1):

z=z+1

if z==0:

print "There are no numbers between", x, " and ", y, "."

if z==1:

print "There is ", z, " number between", x, " and ", y, "."

if (z!=1)&(z!=0):

print "There are ", z, " numbers between", x, " and ", y, "."

y=input('set integer y:')

if y<x:

z=y

y=x

x=z

z=0

for i in range(y-x-1):

z=z+1

if z==0:

print "There are no numbers between", x, " and ", y, "."

if z==1:

print "There is ", z, " number between", x, " and ", y, "."

if (z!=1)&(z!=0):

print "There are ", z, " numbers between", x, " and ", y, "."

## Comments

## Leave a comment