palindrome

Palindrome Checker Assistance

Palindrome Checker Assistance Question: I need help with my Palindrome Checker using the provided instructions 🙁 If someone could show and explain the missing code, it would be a big help! Palindrome Checker Asked By: Silly Piggy || Source Answers: Let’s say you have a list: list1 = [1,2,3,4,5,6] You can use list1.append(7) to output …

Total answers: 1

Add palindrome count

Add palindrome count Question: So I have a code that counts the amount of words But I need it to count palindrome words times instead of one For example, "Kids love doing gag. Gag is good." We first enter how many words we will look for We write 2 Then one by one we write …

Total answers: 2

What's wrong with my code?Valid Palindrome 2- Leetcode 680

What's wrong with my code?Valid Palindrome 2- Leetcode 680 Question: Given a string s, return true if the s can be palindrome after deleting at most one character from it. Example 1: Input: s = "aba" Output: true Example 2: Input: s = "abca" Output: true Explanation: You could delete the character ‘c’. Example 3: …

Total answers: 2

Checking for a palindrome, using for-loop in Python and print output ONLY ONCE

Checking for a palindrome, using for-loop in Python and print output ONLY ONCE Question: I am fairly new to programming, so I hope you can help me. I want to check if a input string is a palindrome. The palindrome-checker is case-insensitive. Here is what I got so far: # input word word = input("Enter …

Total answers: 4

Find palindrome python space complexity?

Find palindrome python space complexity? Question: Given the following code in python which checks whether an string of n size is palindromic: def is_palindromic(s): return all(s[i] == s[~i] for i in range(len(s) // 2)) What is the space complexity of this code? Is it O(1) or O(n)? The all function gets an iterable as a …

Total answers: 2

Palindrome doesn't work inside of a function

Palindrome doesn't work inside of a function Question: I got error of below code while placed in def : " UnboundLocalError: local variable ‘czy_to_palindrome’ referenced before assignment" It works fine without. DOES NOT WORK: while True: print("Podaj liczbe: ", end="") number = input() czy_to_palindrome = True def palindrome_check(number): for i in range(len(number)): if number[i] != …

Total answers: 1

Palindrome Matching Question from Google Kick Start Round E 2022

Palindrome Matching Question from Google Kick Start Round E 2022 Question: Google Kick Start Round E just concluded and I could not figure out what edge case I was missing for my implementation of the Palindrome Matching Question. Problem: You are given a palindrome string P of length N consisting of only lowercase letters of …

Total answers: 1

Creating a palindrome checker with Python's loop and if statements

Creating a palindrome checker with Python's loop and if statements Question: I am trying to follow the instructions to create a palindrome. I am given half a function, and I have to fill in the blanks. I am currently unable to get the loop to work correctly. I am also unsure how to add characters …

Total answers: 14

Check if a number is a palindrome without changing it into string

Check if a number is a palindrome without changing it into string Question: I’m having trouble with this problem that simply return True of False if a number n, is a palindrome. Note: wherever I have a ____ indicates where there is a blank that needs to be filled in. There are 2 blank spaces. …

Total answers: 4

Why does sorting a list return None?

Why does sorting a list return None? Question: My code is written in python 3 and it is meant to print out palindromes. It should iterate through all the palindromic products of 2 3-digit numbers as shown below: mylist=[] for i in range(999,99,-1): for x in range(999, i-1, -1,): number=i*x number=str(number) if number==number[::-1]: #print(number) mylist.append(number) …

Total answers: 1