Skip to content
Merged
1 change: 1 addition & 0 deletions .github/workflows/python-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
black: true
black_args: --line-length 79 # same max line length as flake8
auto_fix: true # auto commit style fixes
7 changes: 3 additions & 4 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

# Uses (Lint Action): https://github.com/marketplace/actions/lint-action#supported-tools
# Uses (Lintly): https://github.com/grantmcconnaughey/Lintly
# Submits code reviews based on flake8 output
name: Python (Lintly)

Expand All @@ -19,12 +18,12 @@ jobs:
with:
python-version: '3.x'

# Install flake8 and lintly
# Install flake8 and Lintly
- name: Install Python dependencies
run: pip install flake8 lintly

# Run Lintly with flake8
- name: Lint with flake8
run: flake8 | lintly --commit-sha=${{ github.event.pull_request.head.sha }} --format=flake8
run: flake8 | lintly --commit-sha=${{ github.event.pull_request.head.sha }}
env:
LINTLY_API_KEY: ${{ secrets.GITHUB_TOKEN }}
9 changes: 8 additions & 1 deletion 1_beginner/chapter2/solutions/favorite.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@
favorite_person = input("Who is your favorite person? ")

# Display output
print(favorite_person + " bought you " + favorite_food + " and " + favorite_drink + ".")
print(
favorite_person
+ " bought you "
+ favorite_food
+ " and "
+ favorite_drink
+ "."
)
5 changes: 4 additions & 1 deletion 1_beginner/chapter3/examples/logic_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
# or
was_computer_bought = True
was_bike_bought = False
print("Was a computer or bike bought? " + str(was_computer_bought or was_bike_bought))
print(
"Was a computer or bike bought? "
+ str(was_computer_bought or was_bike_bought)
)

# not
is_raining = False
Expand Down
4 changes: 3 additions & 1 deletion 1_beginner/chapter3/practice/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

CENTS_PER_DOLLAR = 100

num_cents = int(float(input("How many dollars do you have: $")) * CENTS_PER_DOLLAR)
num_cents = int(
float(input("How many dollars do you have: $")) * CENTS_PER_DOLLAR
)

# What do you do next? Write code here
4 changes: 3 additions & 1 deletion 1_beginner/chapter3/solutions/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
CENTS_PER_NICKEL = 5

# prompt user for dollars and convert it to cents
num_cents = int(float(input("How many dollars do you have: $")) * CENTS_PER_DOLLAR)
num_cents = int(
float(input("How many dollars do you have: $")) * CENTS_PER_DOLLAR
)

# calculate change and display it
dollars = num_cents // CENTS_PER_DOLLAR
Expand Down
9 changes: 4 additions & 5 deletions 1_beginner/chapter5/practice/add_all_the_way.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Add All the Way
# Write a program that asks for and
# reads an input from the user
# Then add all the numbers up from 0
# to that number up. You can use a
# for or while loop. Print out the sum.
# Take a number from the user and
# add every number up from 1 to that number.
# Print the result.
# You can use a for or while loop.

# write code here
2 changes: 1 addition & 1 deletion 1_beginner/chapter5/practice/up_2_fifty.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Write a program that takes a number from the user
# and adds 2 to it until it reaches 50 or more,
# then prints out how many times 2 was added.
# If the number is already greater than 50,
# If the number is already 50 or greater,
# then print out ('Already there!')

# write code here
9 changes: 4 additions & 5 deletions 1_beginner/chapter5/solutions/add_all_the_way.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Add All the Way
# Write a program that asks for and
# reads an input from the user
# Then add all the numbers up from 0
# to that number up. You can use a
# for or while loop. Print out the sum.
# Take a number from the user and
# add every number up from 1 to that number.
# Print the result.
# You can use a for or while loop.

# for loop solution
sum = 0
Expand Down
2 changes: 1 addition & 1 deletion 1_beginner/chapter5/solutions/up_2_fifty.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Write a program that takes a number from the user
# and adds 2 to it until it reaches 50 or more,
# then prints out how many times 2 was added.
# If the number is already greater than 50,
# If the number is already 50 or greater,
# then print out ('Already there!')

# prompt user for a number
Expand Down