Is there anybody who knows how to create a palindrome program without using string functions just conditional statements?
Answer / Dileep Kumar Singh
Creating a palindrome program using only conditional statements can be challenging, but it's possible with some clever coding. One approach is to compare each character in the input string from both ends and check if they are identical. The following code snippet demonstrates this concept:
```
def is_palindrome(n):
num = int(str(n)[::-1])
return n == num
# Test a few numbers to see if they're palindromes
print(is_palindrome(12321)) # True
print(is_palindrome(123456789)) # False
```
In this example, the function `is_palindrome()` checks if a given number `n` is palindromic by comparing it to its reverse (created using string slicing).
| Is This Answer Correct ? | 0 Yes | 0 No |
what is alternater & engine genral protection?
Difference between chopper and dbr?
What is process planning?
What is quality management system? Weather qms is suitable, adequate and effective or not? Is there any quality policy? Is there any quality objective? If yes, then what are they? How they are planning to achieve quality objectives? Do they are measure quality objectives?
what is difference between plc and rtu?
Let’s say we live in a country that gets very cold, in Northern America / Europe. In winter, we monitor the ouside temperature, so that heaters can be switched on, inside the house. The idea is that, the colder it is outside, the warmer it should be inside. The heating side of things is just a heater that is either switched on, or switched off. Just from the information that has been given, please discuss this matter in depth. Provide reference to OPEN / CLOSED loop control, FEEDFORWARD / FEEDBACK control and MODULATING / ON_OFF control raised in the discussion.
What is a profit sharing plan?
What is alternator & engine general protection?
What causes little rust pockets to pop through or off concrete cylinder blocks (home)?
Why we use pneumatic instrument.
how to calibret load cell?
2 Answers Rain Cements, UltraTech,
How to calculate the CFM to TR? What is the Formula
Civil Engineering (5086)
Mechanical Engineering (4453)
Electrical Engineering (16638)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)