Lab # 4
Explanaition: In this program will be used the function “if” and “while” in order to make a cutdown. In addition, it will show the character “<” and “>”.
The objective of this program is to recognize if a number is positive, negative, or zero.
STEPS:
1.- Open python IDLE
2.- Insert the code that will run the program
3.- The program running
SOURCE CODE:
x = input(“Input a number: “)
x = int(x)
if x > 0 :
if (x%2 == 0):
y = x/2
print(“the number”, x, “is even”, “so divided by two is”, y )
else:
z = x*3 + 1
print (“the number”, x,”is odd”, “so multiplied by 3 + 1 is”, z)
else:
print (“you entered a negative number”)
print
print (“End”)