8000 <finish exercises for session1 · Pcodias/intro-to-python@b133eff · GitHub
[go: up one dir, main page]

Skip to content

Commit b133eff

Browse files
author
Replit user
committed
<finish exercises for session1
1 parent b21b5a1 commit b133eff

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1+
12
.DS_Store
3+
4+
.git
5+
6+
 
7+
8+
.env
9+
10+
.venv
11+
12+
env/
13+
14+
venv/
15+
16+
ENV/
17+
18+
env.bak/
19+
20+
venv.bak/
21+
22+
 
23+
24+
.cache
25+
26+
.replit
27+
28+
.config
29+
30+
replit.nix

best_practices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ cd .. # Gets out of the directory you are in
4545
## How do you run a python file?
4646
1. Make sure that you are using the Shell 🐚.
4747
1. Verify that you are in the folder containing the file you want to run. You can use `pwd` to check the current folder and `ls` to see the files in the current folder.
48-
2. Run `python <file_name.py>` (ex: `python session_1.py`).
48+
2. Run `python <file_name.py>` (ex: `python exercises_1.py`).
4949

5050
---
5151

session_01/exercises_1.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
## Section A
1313
# 1. Write code that prints ‘Hello world’.
14-
15-
14+
print("Hello_world")
1615

1716
# 2. Print the numbers 1 to 5 on a single line.
18-
17+
print("1 2 3 4 5")
1918

2019

2120
# 3. Write a script where ‘Hello’ and ‘World’ are printed on two separate lines.
21+
print("Hello\nWorld")
2222

2323

2424

@@ -28,31 +28,35 @@
2828
# Bob
2929
# Charlie
3030
# ```
31-
31+
print("My List of Names:\n\tAlice\ntBob\n\tCharlie")
3232

3333

3434

3535
# <---------------------------------------------------------------------------------------------->
3636

3737
## Section B
3838
# 1. Write code that prints the value of 2 + 2.
39-
39+
# print(2+2)
4040

4141

4242
# 2. Write code that prints the value of 5.7 subtracted from 3.4.
43+
# result = 3.4 - 5.7
4344

4 90AB 445

4546

4647
# 3. Write code that prints the value of 8 multiplied by 7.
48+
# print(8*7)
4749

4850

4951

5052
# 4. Write code that prints the value of 144 divided by 12.
53+
# print(144/12)
5154

5255

5356

5457
# 5. Write code that prints the value of the remainder of 67 divided by 12.
55-
58+
# print(67 % 12)
5659

5760

5861
# 6. Write code that finds the value of 20 from `4 - 2 * 6 / 3 * 5`. Hint: you might need brackets.
62+
# print((4-2) * 6 / 3 * 5)

0 commit comments

Comments
 (0)
0