About 333,000 results
Open links in new tab
  1. Python: Find two indices making a given string unhappy

    Apr 17, 2025 · Write a Python program to slide a window of size 3 over a string and output the indices where duplicates occur. Write a Python program to use iteration and comparison to …

  2. Python program to check if the given number is Happy Number

    Apr 15, 2024 · In this example, below code defines two functions: numSquareSum calculates the sum of squares of digits of a number, and isHappyNumber checks if a number is a Happy …

  3. python - Program for happy numbers - Stack Overflow

    Jul 19, 2020 · The only problem is that the program will be stuck if you try with a non-happy number (like 58) that will keep looping. Another way is to loop until the result is one-digit long …

  4. Understanding and Implementing Happy Number Check in Python

    Mar 7, 2024 · Our task is to implement a Python program to determine if a given number is happy. For example, input 19 should result in output “True” since 1 2 + 9 2 = 82, 8 2 + 2 2 = 68, 6 2 + …

  5. Python program that uses a while loop and the split() method to …

    Jan 13, 2023 · Here is a Python program that uses a while loop and the split() method to check if a given number is a happy number: The function is_happy(n) takes an integer as an argument, …

  6. Python Program - Check Number Is a Happy Number - Learn …

    Mar 6, 2022 · In this python program example, we need to check for a happy number. A number is said to be a Happy Number if the sum of the squares of all the digits in that number yield one …

  7. Encryption Algorithm Based on Happy Numbers Using Python

    So now what you want to do is, add the happy number to the index of alphabet from position 3, get the new alphabet according to the list and replace the alphabet from the list made of the …

  8. Happy Number from Python list - Stack Overflow

    Jun 30, 2022 · Generally, I think a function like is_happy should return a true/false statement(s). So a sample returned list can be ["True", "False", "True", "True"] for your input example [1, 4, …

  9. Check If A Number Is A Happy Number - CodeSpeedy

    In this tutorial, we will be looking at a python program to check if a number is a happy number or not. We will be using the following Python concepts to solve this problem: Python if…else …

  10. Python Program to check if a number is Happy number

    Sep 11, 2020 · A number is said to be a happy number if it results in 1 when replaced by the sum of squares of its digits recursively. If this process results in an endless loop of numbers …

  11. Some results have been removed
Refresh