fork download
  1. def new_string(text):
  2. """
  3. Returns a new string with "Is" added to the front,
  4. unless the string already begins with "Is".
  5. """
  6. if text.startswith("Is"):
  7. return text
  8. else:
  9. return "Is" + text
  10.  
  11. # Get input from the user
  12. string = input("Enter a string: ")
  13.  
  14. # Call the function and print the result
  15. new_string = new_string(string)
  16. print("New string:", new_string)
Success #stdin #stdout 0.03s 9704KB
stdin
Isdfg
stdout
Enter a string: New string: Isdfg