You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lesson_04/README.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,4 +9,9 @@ Please review the following resources before lecture:
9
9
10
10
## Homework
11
11
12
-
- TODO(anthonydmays): Provide details
12
+
-[ ] Do [coding exercise](#writing-some-code).
13
+
-[ ] Do pre-work for [lesson 05](/lesson_05/).
14
+
15
+
### Writing some code
16
+
17
+
For this assignment, you will need to write code that determines whether a number is a prime number. You will produce code in two different languages, then provide a 100+ word write up about the similarities and differences between the two implementations you made. An example is provided in the [anthonydmays/](./anthonydmays/) folder.
The Python implementation uses a function named `is_even` that takes a single argument `number`. It returns `True` if the number is even (i.e., when the remainder of the division of the number by 2 is zero), otherwise, it returns `False`.
27
+
28
+
The JavaScript implementation uses a function named `isEven` that also takes a single argument `number`. It returns `true` if the number is even (using the same logic as the Python function) and `false` otherwise.
29
+
30
+
### Differences
31
+
32
+
1.**Syntax**:
33
+
- In Python, functions are defined using the `def` keyword, whereas in JavaScript, the `function` keyword is used.
34
+
- Python uses `True` and `False` for boolean values, while JavaScript uses `true` and `false`.
35
+
36
+
2.**Type Coercion**:
37
+
- JavaScript has type coercion, which can sometimes lead to unexpected results if the input is not properly handled. In contrast, Python is more strict with types.
38
+
39
+
3.**Function Calls**:
40
+
- The syntax for calling functions and printing to the console/output is slightly different. Python uses `print()`, while JavaScript uses `console.log()`.
0 commit comments