Count the number of numbers in a given range whose cube ends in 4 or 9
📁 Advanced Python Topics, AI
Number of numbers
The program receives two integers a and b (a≤b). Write a program that counts the number of numbers in the range from a to b inclusive whose cube ends in 4 or 9.
Input format
The program receives two integers a and b (a≤b).
Output format
The program should output one integer according to the program condition. Note: The cube of a number a is its third power a^3.
Sample Input 1:
110counter = 0for i in range(int(
You could also just compare the original word with its reversed version [::-1]. There was such a problem on stepic.org) I solved it like this
slovo = str(input())a = slovo[::-1]if slovo == a: print("yes")else: print("no") Log in to leave an answer