diff --git a/1_beginner/chapter7/practice/replace.py b/1_beginner/chapter7/practice/replace.py index 9ebe2221..86338be9 100644 --- a/1_beginner/chapter7/practice/replace.py +++ b/1_beginner/chapter7/practice/replace.py @@ -1,12 +1,14 @@ """ Replace -Write a Python program to print a string -from a given string where all occurrences -of its first char have been changed to '$', +Write a Python program that asks the user for a string +and then prints a version of that string +where all occurrences of its first char +have been changed to '$', except the first char itself. -Sample String : 'restart' -Expected Result : 'resta$t' + +Sample Input: 'restart' +Expected Output: 'resta$t' Adapted from W3Resource, problem 4: https://www.w3resource.com/python-exercises/string/ diff --git a/1_beginner/chapter7/practice/upper.py b/1_beginner/chapter7/practice/upper.py index 2894d162..18ea29b9 100644 --- a/1_beginner/chapter7/practice/upper.py +++ b/1_beginner/chapter7/practice/upper.py @@ -1,6 +1,7 @@ # Upper # Continuously ask a user to enter words. -# (Make sure that the input given is actually just 1 word.) +# You should remove leading/trailing whitespace, and then +# make sure that the word is only made up of letters. # Store the words in a list. # Stop asking the user for words if they enter an empty string # (the string has no characters or is completely whitespace). diff --git a/1_beginner/chapter7/solutions/replace.py b/1_beginner/chapter7/solutions/replace.py index e2f84c14..68bf0b37 100644 --- a/1_beginner/chapter7/solutions/replace.py +++ b/1_beginner/chapter7/solutions/replace.py @@ -1,13 +1,14 @@ """ Replace -Write a Python program to print a string -from a given string where all occurrences -of its first char have been changed to '$', +Write a Python program that asks the user for a string +and then prints a version of that string +where all occurrences of its first char +have been changed to '$', except the first char itself. -Sample String: 'restart' -Expected Result: 'resta$t' +Sample Input: 'restart' +Expected Output: 'resta$t' Adapted from W3Resource, problem 4: https://www.w3resource.com/python-exercises/string/ diff --git a/1_beginner/chapter7/solutions/upper.py b/1_beginner/chapter7/solutions/upper.py index 1d10b83b..6594205f 100644 --- a/1_beginner/chapter7/solutions/upper.py +++ b/1_beginner/chapter7/solutions/upper.py @@ -1,6 +1,7 @@ # Upper # Continuously ask a user to enter words. -# (Make sure that the input given is actually just 1 word.) +# You should remove leading/trailing whitespace, and then +# make sure that the word is only made up of letters. # Store the words in a list. # Stop asking the user for words if they enter an empty string # (the string has no characters or is completely whitespace).