Hacks / Homework

  • Hack 1: Write a Python function that takes a string as input and returns the string reversed.
  • Hack 2: Create a Python program that counts the number of vowels (‘a’, ‘e’, ‘i’, ‘o’, ‘u’) in a given string.
  • Hack 3: Given a string, write a function to replace all occurrences of the substring ‘abc’ with ‘xyz’.
  • Hack 4: Write a function that checks if a given string is a palindrome (reads the same forward and backward), ignoring spaces, punctuation, and case.
  • Hack 5: Write a program that finds and returns the longest word in a given sentence.

CHALLENGING QUESTION:

  • Hack 6: Given a string containing both letters and digits, write a function that extracts all the numbers, sums them up, and returns the total.