|
| 1 | +# Strings and string methods |
| 2 | + |
| 3 | +These exercises do not need to be completed in order, but they are generally ordered in increasing difficulty. The solutions provided _are not the only possible_ solution. Your's might look different, and that is okay! |
| 4 | + |
| 5 | +1. Write a Python program to calculate the length of a string (from [w3resource](https://www.w3resource.com/python-exercises/string/)). |
| 6 | + |
| 7 | +2. Write a Python script that takes input from the user and displays that input back in upper and lower cases (from [w3resource](https://www.w3resource.com/python-exercises/string/)). |
| 8 | + |
| 9 | +3. Make a program that takes a string and outputs that string with the first letter of each word capitalized. |
| 10 | + |
| 11 | +4. Given an input string, write a program that identifies the index of the first instance of a character within that string. |
| 12 | + |
| 13 | +5. Given an input string, find the three most common characters within that string and the number of times they are contained. |
| 14 | + |
| 15 | +6. Write a program to split a given string on hyphens and display each substring (from [PYnative](https://pynative.com/python-string-exercise/)). |
| 16 | + |
| 17 | +7. Write a program to create a new string made of an input string’s first, middle, and last character (from [PYnative](https://pynative.com/python-string-exercise/)). |
| 18 | + |
| 19 | +8. Write a Python program to change a given string to a new string where the first and last chars have been exchanged (from [w3resource](https://www.w3resource.com/python-exercises/string/)). |
| 20 | + |
| 21 | +9. Write a Python program to get a single string from two given strings, separated by a space (from [w3resource](https://www.w3resource.com/python-exercises/string/)). |
| 22 | + |
| 23 | +10. Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged (from [w3resource](https://www.w3resource.com/python-exercises/string/)). |
| 24 | + |
| 25 | +11. Write a Python program to remove the nth index character from a nonempty string (from [w3resource](https://www.w3resource.com/python-exercises/string/)). |
| 26 | + |
| 27 | +12. Write a Python program to get the last part of a string before a specified character (from [w3resource](https://www.w3resource.com/python-exercises/string/)). |
| 28 | + |
| 29 | +13. Write a Python program to add a prefix text to all of the lines in a string (from [w3resource](https://www.w3resource.com/python-exercises/string/)). |
| 30 | + |
| 31 | +14. Write a Python program to accept a filename from the user and print the extension of that (from [w3resource](https://www.w3resource.com/python-exercises/python-basic-exercises.php)). |
0 commit comments