Create a Python script that will accept three integers and will check each input number. If the input number is EVEN it will display the square of cube of the number and if the number is ODD it will display the square of the number.
Sample Output
Number 1: 5
Number 2: 8
Number 3: 3 The square of 5 is 25
The cube of 8 is 512 The square of 3 is 9.
I need the complete coding of this. Thank you
numbers = []
for i in range(1, 4):
print(f'Enter number {i}: ', end='')
x = input()
if x.isdigit():
numbers.append(int(x))
else:
print('You entered not a number!')
for i in range(len(numbers)):
x = numbers[i]
print(f'\n\nNumber {i+1}: {x}')
if x % 2 == 1:
print(f'The square of {x} is {x*x}')
else:
print(f'The cube of {x} is {x*x*x}')
Comments
Leave a comment