Skip to content

Commit 71fc97c

Browse files
authored
Merge pull request #34 from code-for-tomorrow/exercises
Clarify Upper instructions
2 parents c0baacf + 24839ce commit 71fc97c

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

1_beginner/chapter7/practice/replace.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
"""
22
Replace
33
4-
Write a Python program to print a string
5-
from a given string where all occurrences
6-
of its first char have been changed to '$',
4+
Write a Python program that asks the user for a string
5+
and then prints a version of that string
6+
where all occurrences of its first char
7+
have been changed to '$',
78
except the first char itself.
8-
Sample String : 'restart'
9-
Expected Result : 'resta$t'
9+
10+
Sample Input: 'restart'
11+
Expected Output: 'resta$t'
1012
1113
Adapted from W3Resource, problem 4:
1214
https://www.w3resource.com/python-exercises/string/

1_beginner/chapter7/practice/upper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Upper
22
# Continuously ask a user to enter words.
3-
# (Make sure that the input given is actually just 1 word.)
3+
# You should remove leading/trailing whitespace, and then
4+
# make sure that the word is only made up of letters.
45
# Store the words in a list.
56
# Stop asking the user for words if they enter an empty string
67
# (the string has no characters or is completely whitespace).

1_beginner/chapter7/solutions/replace.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""
22
Replace
33
4-
Write a Python program to print a string
5-
from a given string where all occurrences
6-
of its first char have been changed to '$',
4+
Write a Python program that asks the user for a string
5+
and then prints a version of that string
6+
where all occurrences of its first char
7+
have been changed to '$',
78
except the first char itself.
89
9-
Sample String: 'restart'
10-
Expected Result: 'resta$t'
10+
Sample Input: 'restart'
11+
Expected Output: 'resta$t'
1112
1213
Adapted from W3Resource, problem 4:
1314
https://www.w3resource.com/python-exercises/string/

1_beginner/chapter7/solutions/upper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Upper
22
# Continuously ask a user to enter words.
3-
# (Make sure that the input given is actually just 1 word.)
3+
# You should remove leading/trailing whitespace, and then
4+
# make sure that the word is only made up of letters.
45
# Store the words in a list.
56
# Stop asking the user for words if they enter an empty string
67
# (the string has no characters or is completely whitespace).

0 commit comments

Comments
 (0)