Skip to content

Commit ac67a5a

Browse files
Neha PeddintiNeha Peddinti
authored andcommitted
Merge branch 'neha-add-exercises' of https://github.com/code-for-tomorrow/python into add_exercises
2 parents 91d1508 + a910f06 commit ac67a5a

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

1_beginner/chapter3/solutions/integer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
x = float(input("Enter a number: "))
1111

1212
# Compare x to the integer version of itself
13-
is_integer = (x == int(x))
13+
is_integer = x == int(x)
1414

1515
print("Is integer? " + str(is_integer))

1_beginner/chapter3/solutions/names.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
name2 = input("Person 2: ")
1111

1212
# "False" if name1 and name2 are equal
13-
not_same = (name1 != name2)
13+
not_same = name1 != name2
1414

1515
print("Not the same?", not_same)

1_beginner/chapter6/solutions/manipulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
if i % 3 == 0:
4646
more_nums.remove(i)
4747

48-
more_nums.insert(more_nums.index(20)+1, 21)
48+
more_nums.insert(more_nums.index(20) + 1, 21)
4949

5050
for i in range(15):
5151
more_nums.insert(-2, 0)

1_beginner/chapter6/solutions/names.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Some other possible answers:
1515
# group = people[0, 5, 2] or people[0, len(people), 2]
1616

17-
group = people[0:len(people):2]
17+
group = people[0 : len(people) : 2]
1818

1919
print(people)
2020
print(group)

1_beginner/chapter6/solutions/restaurant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
print()
121121

122122
# Ask if the user wants to order again
123-
ans = input("Do you want to order again (\"yes\" or \"no\")? ")
123+
ans = input('Do you want to order again ("yes" or "no")? ')
124124
print()
125125
if ans == "no":
126126
break

1_beginner/chapter7/solutions/capital.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
str = input("Enter a string: ")
1717

1818
new_str = ""
19-
letter_count = 0 # Used to avoid counting non-alpha characters.
19+
letter_count = 0 # Used to avoid counting non-alpha characters.
2020

2121
for c in str:
2222
if c.isalpha():

2_intermediate/chapter8/solutions/food.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
prompts = [
1616
"Enter a fruit: ",
1717
"Enter a vegetable: ",
18-
"Enter a junk food item: "
18+
"Enter a junk food item: ",
1919
]
2020

2121
# Choose a random prompt and collect input.

2_intermediate/chapter8/solutions/fortune.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
import random
1212

1313
messages = [
14-
"You will meet the love of your life today.",
15-
"You will turn into a fish.",
16-
"It will rain diamonds today.",
17-
"You will encounter a field of mangoes.",
18-
"Look for the light. Underneath it, there will be a chess board.",
19-
"You'll run a sub-6:00 mile today."
14+
"You will meet the love of your life today.",
15+
"You will turn into a fish.",
16+
"It will rain diamonds today.",
17+
"You will encounter a field of mangoes.",
18+
"Look for the light. Underneath it, there will be a chess board.",
19+
"You'll run a sub-6:00 mile today.",
2020
]
2121

2222
print(messages[random.randrange(len(messages))])

0 commit comments

Comments
 (0)