Question: How do code this in python3? it saids to follow the orders and have the output as the same as the sample runs Your program
How do code this in python3? it saids to follow the orders and have the output as the same as the sample runs
Your program must contain a main function, which in turn calls other functions. The only statement in your program that is not contained in a function should be a call to the main function. Your program should do the following things, in this order: 1. Write a function to reverse a string. Your function must use a loop to reverse the string. 2. Write a function that determines whether or not a word is a palindrome (is the same forward Return the reversed string from the function. and backward, i.e. "mom" or "noon"). Use your function from Q1 to help determine this. Return a boolean that indicates whether or not the word is a palindrome. Prompt the user to enter a word, then determine whether or not it is a palindrome. Use your function from Q2 to do this. Print out either, "Palindrome!" or "Not a palindrome." Your program should prompt the user three times. Here is a sample run of the program: 3. Enter a word: noon Palindrome! Enter a word: potato Not a palindrome. Enter a word: racecar Palindrome! 4. Write a function that determines whether or not a number is a prime number. Return a 5. An emirR (prime spelled backwards) is a nonpalindromi boolean that indicates whether or not the number is prime. prime number whose reversal is also a prime. For example, 17 and 71 are both prime numbers, so 17 and 71 are emirps Because 11 is a palindrome, it is not an emirp, even though it is prime. Prompt the user to enter a number, then determine whether or not this number is an emi. Use your reverse function from Q1, your palindrome function from Q2, and your prime function from Q4 to do this. Print out either, "Emip" or "Not an emirp. "Your program should prompt the user three imes. Here is a sample run of the program: Enter a number: 17 Emirp! Enter a number: 42 Not an emirp Enter a number: 149 Emim! Twin primes are a pair of prime numbers that differ by 2. For example, 3 and 5, 5 and 7, and 11 and 13 are twin primes. Write a function to find and print all the twin primes less than 1,000. Use your prime function from Q4 to do this. 6. Print the output as follows: 3,5 5,7 11,13 17,19 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
