Skip to content

Commit e3bdffd

Browse files
committed
feat: adds Kimberlee's lesson_07 conditionals
1 parent 6e4e004 commit e3bdffd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lesson_07/conditionals/src/lesson7.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ export function myGrade(grade: number): string {
7474
return gpa;
7575
}
7676

77-
//I followed the same logic as question 2. I can already tell that
78-
// there may be many simpler ways to build this function. I am just
79-
// happy it came out with no errors and will make a note to play around
80-
// with this and see if I can't get it to look better (simpler/cleaner).
77+
//I followed the same logic as question 2.
8178

8279
export function convertGpaToLetterGrade(gpa: number): string {
8380
if (gpa >= 4.0) {
@@ -107,7 +104,7 @@ export function convertGpaToLetterGrade(gpa: number): string {
107104
}
108105
}
109106

110-
const grade = convertGpaToLetterGrade(32);
107+
const grade = convertGpaToLetterGrade(3.2);
111108
console.log(grade);
112109

113110
/** (Q4)
@@ -166,7 +163,7 @@ export function getFirstNFibonacciNumbers(n: number): number[] {
166163
myArray.push(1, 1);
167164

168165
for (let i = 2; i < n; i++) {
169-
//initialization(stats at 2 because I added the first two numbers in the sequence above)
166+
//initialization(starts at 2 because I added the first two numbers in the sequence above)
170167
// so this tells the function to start computing from the 3rd number. Condition: this tells
171168
// the function that it can only work with numbers less than the given number.
172169
// Increment: this tells the function to move on to the next number by 1 (no infinite loops).
@@ -208,3 +205,6 @@ export function binarySearch(
208205
return binarySearch(values, pivotIndex + 1, end, value);
209206
}
210207
// This problem was much easier to write out because of question 6.
208+
const values = [ 2, 4, 6, 8, 10, 12, 14, 16];
209+
const index = binarySearch(values, 4, 8, 14);
210+
console.log(index);

0 commit comments

Comments
 (0)