100 Python practice questions

100 Python practice questions, I hope it will help you improve!
insert image description here

  1. Write a program that takes two numbers and calculates their sum.
  2. Write a program that takes a string as input and outputs that string in reverse order.
  3. Write a program to check whether a number is prime or not.
  4. Write a program that calculates and outputs the first n terms of the Fibonacci sequence (n is input by the user).
  5. Write a program to determine whether a string is a palindrome.
  6. Write a program to find the largest and smallest value in a list.
  7. Write a program to check if a year is a leap year.
  8. Write a program that merges two lists into a new list.
  9. Write a program to check whether a number is a perfect square.
  10. Write a program that counts the number of occurrences of each character in a string.
  11. Write a program that calculates the area of ​​a circle based on a radius entered by the user.
  12. Write a program to check whether a string is a substring of another string.
  13. Write a program to deduplicate elements in a list.
  14. Write a program to find all even numbers in a list.
  15. Write a program to check whether a number is negative or not.
  16. Write a program that counts the number of words contained in a string.
  17. Write a program to determine whether a number is a daffodil number.
  18. Write a program that calculates and outputs the factorial of n (n is input by the user).
  19. Write a program to determine whether a string is a palindromic prime.
  20. Write a program to find all odd numbers in a list.
  21. Write a program to convert a string to lowercase.
  22. Write a program to check whether a number is perfect or not.
  23. Write a program to calculate the greatest common divisor of two numbers.
  24. Write a program to count the occurrence frequency of each character in a string.
  25. Write a program to determine whether a string is a palindrome.
  26. Write a program that generates random numbers within a specified range.
  27. Write a program that converts a string to uppercase.
  28. Write a program to check whether a number is prime or not.
  29. Write a program to calculate and output all prime numbers within n (n is input by the user).
  30. Write a program to check whether a string is isomorphic.
  31. Write a program to find all prime numbers in a list.
  32. Write a program to calculate the least common multiple of two numbers.
  33. Write a program to determine whether a number is a palindrome.
  34. Write a program to calculate and output all perfect numbers within n (n is input by the user).
  35. Write a program to find the longest word in a string.
  36. Write a program to determine whether a year is a leap year, and if so, calculate the total number of days in that year.
  37. Write a program to sort the elements of a list in ascending order.
  38. Write a program to determine whether a string is a palindromic substring.
  39. Write a program to find all the words in a string.
  40. Write a program to determine whether a number is a golden section number.
  41. Write a program to calculate and output all Fibonacci numbers within n (n is input by the user).
  42. Write a program to determine whether a string is an anagram.
  43. Write a program that calculates the average of all numbers in a list.
  44. Write a program to check whether a number is negative or not.
  45. Write a program to find the longest palindromic substring in a string.
  46. Write a program to determine whether a string contains repeated characters.
  47. Write a program to determine whether a number is automorphic.
  48. Write a program that outputs a list in reverse order.
  49. Write a program to determine whether a string is an anagram.
  50. Write a program to count the number of occurrences of each element in a list.
  51. Write a program to determine whether a number is a pigeon number.
  52. Write a program to convert a string to an integer.
  53. Write a program to determine whether two strings are rotation words.
  54. Write a program that calculates the product of all the numbers in a list.
  55. Write a program to check whether a number is a perfect cube.
  56. Write a program to find the shortest word in a string.
  57. Write a program to check whether a string is an isomorphic substring.
  58. Write a program to sort the elements of a list in descending order.
  59. Write a program to check whether a number is a positive integer or not.
  60. Write a program to generate a random password of a specified length.
  61. Write a program to determine whether two strings are anagrams.
  62. Write a program that calculates and prints the cube root of a number.
  63. Write a program to determine whether a string is composed of unique characters.
  64. Write a program to split a string into two parts at the middle.
  65. Write a program to find all palindromic substrings in a string.
  66. Write a program to determine whether a number is an affinity number.
  67. Write a program to reverse a list.
  68. Write a program to determine whether two strings are isomorphic permutations.
  69. Write a program that calculates and prints the square root of a number.
  70. Write a program to determine whether a string consists of consecutive numbers.
  71. Write a program to find the most frequently occurring character in a string.
  72. Write a program to determine whether a number is a lucky number.
  73. Write a program to encrypt and decrypt a string.
  74. Write a program to check whether two lists are identical.
  75. Write a program to determine whether a string consists of repeated substrings.
  76. Write a program that calculates and outputs the circumference and area of ​​a circle (radius is entered by the user).
  77. Write a program to find all anagrams in a string.
  78. Write a program to randomly sort a list.
  79. Write a program to determine whether a number is a happy number.
  80. Write a program to rotate a string left and right.
  81. Write a program that counts the number of consecutive zeros at the end of the factorial of a number.
  82. Write a program to determine whether a string consists of unique characters.
  83. Write a program to find the most frequently occurring word in a string.
  84. Write a program to check whether a number is a reverse prime number.
  85. Write a program that computes the dot product of two vectors.
  86. Write a program to determine whether a number is the cube of a positive integer.
  87. Write a program to find all isomorphic permutations in a string.
  88. Write a program to count the number of elements in a list greater than or equal to a certain threshold.
  89. Write a program to determine whether a string has repeated characters.
  90. Write a program that computes and prints the square root of a purely imaginary number.
  91. Write a program to find the longest word in a string.
  92. Write a program to check whether a number is reversible prime.
  93. Write a program that calculates the product of two matrices.
  94. Write a program to determine whether a string consists of consecutive letters.
  95. Write a program that merges and sorts two ordered lists.
  96. Write a program to count the length of the longest palindromic substring in a string.
  97. Write a program to check whether a number is the cube root of a positive integer.
  98. Write a program that calculates the non-zero digits at the end of the factorial of a number.
  99. Write a program to find the first occurrence of a character in a string.
  100. Write a program to determine whether a number is highly composite.

Please note that the purpose of these practice questions is to provide programming exercises, and you can choose the questions to solve according to your ability and interest. If you encounter difficulties in the process of answering, you can refer to relevant programming knowledge and documents, or search for corresponding solutions. You can also discuss in the comment area, and the answers to 10 questions will be announced every day in the future. I wish you a happy programming!

Guess you like

Origin blog.csdn.net/m0_55877125/article/details/132086499