Python programming Program 1 – Palindromes – 25 points Write a Python program called Palindromes.py to read in a number of strings from the user. Stop when the user enters Done. Then check if each of...

1 answer below »
The objective of this assignment is to write two small level programs in Python.


Python programming Program 1 – Palindromes – 25 points Write a Python program called Palindromes.py to read in a number of strings from the user. Stop when the user enters Done. Then check if each of the strings is a palindrome (ignore case and spaces) and throw the palindromic strings into a dictionary, where the key is a counter and the value is the string. Finally, print the dictionary. You can assume that your strings will only contain lower and uppercase letters and spaces. Sample Run: Enter the strings: taco Cat sWAp paws Who are you people Wumbology 1 Rats live on no evil star Done The palindromes are: {1: taco Cat, 2: sWAp paws, 3: Rats live on no evil star} Program 2 – Factors – 25 points Write a Python program called Factors.py to factor all integers less than a user-defined number into non-negative integers. For this program, you may not use the numpy library. Store the factors for each number in a dictionary that maps ints to sets of ints, and print the dictionary before termination. Sample Run: Enter max number: 6 {1: {1}, 2: {1, 2}, 3: {1, 3}, 4: {1, 2, 4}, 5: {1, 5}, 6: {1, 2, 3, 6}} Generic Guidelines • Your program should load and run without issues. Every interpretation error will result in a loss of 5 points. • You are restricted to standard Python. No third party libraries.
Answered 1 days AfterSep 04, 2021

Answer To: Python programming Program 1 – Palindromes – 25 points Write a Python program called Palindromes.py...

Arun Shankar answered on Sep 06 2021
142 Votes
def is_palindrome(s):
for i in range(len(s)):
if(s[i] != s[len(s) - 1 - i]):
return F
alse
return True
print("Enter the strings:")
s = ""
dct = {}
count = 1
while(s != "Done"):
s = input()
# ignore sapces and case
t = ""
for letter in s:
if letter != ' ':
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here