Answer & Explanation:
import java.util.Scanner;
//written in java
public class Main {
public static void main(String[] args) {
//next line declares an integer variable numCars
int numCars;
//next line uses a scanner class to take input
Scanner input = new Scanner(System.in);
//next line take and ensures input is an integer
numCars = input.nextInt();
//next line displays variable numCars using println to print it on new line
System.out.println("Number of cars: " + numCars);
}
}
Answer:
string = input()
normal = ""
reverse = ""
for i in range(len(string)):
if string[i].isalpha():
normal += string[i].lower()
reverse = string[i].lower() + reverse
if normal == reverse:
print(string + " is a palindrome")
else:
print(string + " is not a palindrome")
Explanation:
- Loop up to the length of string.
- Use an if statement to check if a certain character is an alphabet.
- Check if both the normal and reverse strings are equal, then display that it is a palindrome.
Idk what that means but sounds like they want you to help answer the really hard an challenging questions lol