Skip to content

Commit f97ea7a

Browse files
authored
Merge pull request #25 from code-for-tomorrow/fix-typos
Clarify instructions for Ch. 5 exercises
2 parents 107b719 + 7be5ac1 commit f97ea7a

File tree

10 files changed

+32
-20
lines changed

10 files changed

+32
-20
lines changed

.github/workflows/python-format.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ jobs:
2727
with:
2828
github_token: ${{ secrets.GITHUB_TOKEN }}
2929
black: true
30+
black_args: --line-length 79 # same max line length as flake8
3031
auto_fix: true # auto commit style fixes

.github/workflows/python-lint.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
# Uses (Lint Action): https://github.com/marketplace/actions/lint-action#supported-tools
1+
# Uses (Lintly): https://github.com/grantmcconnaughey/Lintly
32
# Submits code reviews based on flake8 output
43
name: Python (Lintly)
54

@@ -19,12 +18,12 @@ jobs:
1918
with:
2019
python-version: '3.x'
2120

22-
# Install flake8 and lintly
21+
# Install flake8 and Lintly
2322
- name: Install Python dependencies
2423
run: pip install flake8 lintly
2524

2625
# Run Lintly with flake8
2726
- name: Lint with flake8
28-
run: flake8 | lintly --commit-sha=${{ github.event.pull_request.head.sha }} --format=flake8
27+
run: flake8 | lintly --commit-sha=${{ github.event.pull_request.head.sha }}
2928
env:
3029
LINTLY_API_KEY: ${{ secrets.GITHUB_TOKEN }}

1_beginner/chapter2/solutions/favorite.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,11 @@
99
favorite_person = input("Who is your favorite person? ")
1010

1111
# Display output
12-
print(favorite_person + " bought you " + favorite_food + " and " + favorite_drink + ".")
12+
print(
13+
favorite_person
14+
+ " bought you "
15+
+ favorite_food
16+
+ " and "
17+
+ favorite_drink
18+
+ "."
19+
)

1_beginner/chapter3/examples/logic_operators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
# or
1212
was_computer_bought = True
1313
was_bike_bought = False
14-
print("Was a computer or bike bought? " + str(was_computer_bought or was_bike_bought))
14+
print(
15+
"Was a computer or bike bought? "
16+
+ str(was_computer_bought or was_bike_bought)
17+
)
1518

1619
# not
1720
is_raining = False

1_beginner/chapter3/practice/change.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
CENTS_PER_DOLLAR = 100
2121

22-
num_cents = int(float(input("How many dollars do you have: $")) * CENTS_PER_DOLLAR)
22+
num_cents = int(
23+
float(input("How many dollars do you have: $")) * CENTS_PER_DOLLAR
24+
)
2325

2426
# What do you do next? Write code here

1_beginner/chapter3/solutions/change.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
CENTS_PER_NICKEL = 5
2424

2525
# prompt user for dollars and convert it to cents
26-
num_cents = int(float(input("How many dollars do you have: $")) * CENTS_PER_DOLLAR)
26+
num_cents = int(
27+
float(input("How many dollars do you have: $")) * CENTS_PER_DOLLAR
28+
)
2729

2830
# calculate change and display it
2931
dollars = num_cents // CENTS_PER_DOLLAR
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Add All the Way
2-
# Write a program that asks for and
3-
# reads an input from the user
4-
# Then add all the numbers up from 0
5-
# to that number up. You can use a
6-
# for or while loop. Print out the sum.
2+
# Take a number from the user and
3+
# add every number up from 1 to that number.
4+
# Print the result.
5+
# You can use a for or while loop.
76

87
# write code here

1_beginner/chapter5/practice/up_2_fifty.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Write a program that takes a number from the user
33
# and adds 2 to it until it reaches 50 or more,
44
# then prints out how many times 2 was added.
5-
# If the number is already greater than 50,
5+
# If the number is already 50 or greater,
66
# then print out ('Already there!')
77

88
# write code here

1_beginner/chapter5/solutions/add_all_the_way.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Add All the Way
2-
# Write a program that asks for and
3-
# reads an input from the user
4-
# Then add all the numbers up from 0
5-
# to that number up. You can use a
6-
# for or while loop. Print out the sum.
2+
# Take a number from the user and
3+
# add every number up from 1 to that number.
4+
# Print the result.
5+
# You can use a for or while loop.
76

87
# for loop solution
98
sum = 0

1_beginner/chapter5/solutions/up_2_fifty.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Write a program that takes a number from the user
33
# and adds 2 to it until it reaches 50 or more,
44
# then prints out how many times 2 was added.
5-
# If the number is already greater than 50,
5+
# If the number is already 50 or greater,
66
# then print out ('Already there!')
77

88
# prompt user for a number

0 commit comments

Comments
 (0)