Skip to content

feat: added Dasia Lesson_05 User stories #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 11, 2024
70 changes: 70 additions & 0 deletions lesson_04/dasiaenglish/lesson_04.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
```Javascript
#Javascript

function findPrimes(numberToCheck) { // A machine that helps find prime numbers

if (numberToCheck <=1){
return `${numberToCheck} is not a prime number.`; //any number that is less or equal to 1 it is NOT a prime number
}
let isPrime = true; //I am start with assuming the number is prime


for (let factor = 2; factor <= Math.floor(numberToCheck / 2); factor++) { //this is another loop but it checks to see if the number is divisible by other numbers.
if (numberToCheck % factor === 0) { // this is checking to see if the number can divide evenly and if so then it is not a prime number
isPrime = false; // states that the number is not prime if it comes out as 0 (should have a remainder)
break; //states that it can STOP the loop once it finds a 0, no need to keep going through
} //this is closing the loop
}

if (isPrime) { //if said number is still true that means that we did not find any number that is divided evenly so it is prime
return `${numberToCheck} is a prime number.`; //if the numbe is prime it will say^^
} else{
return `${numberToCheck} is not a prime number.`; // if it is NOT prime it will say so
}
} //closing the loop of if it is a prime number or not

const input = process.argv[2]; // telling the computer to save the 3rd thing you type

let number = parseInt(input); // if it types a word the computer does the math and makes it a number

if (isNaN(number)) { // make sure you type a number
console.log("Please enter a valid number."); // letting the user know you have to type a number
} else {
console.log(findPrimes(number)); //now the computer can check if it is prime or not
}

// credit from Coding with John youtube video https://www.youtube.com/watch?v=I9-3drnfyp0 and Chatgpt for a explanation of things I still might have been confused about
```

```python
# Python
# this is a function that will help us find all the prime numbers
def find_primes(number_to_check):
if number_to_check <= 1: # this is an empty list for now until we run the test for all the prime numbers we find
return f"{number_to_check} is not a prime number."

is_prime = True # I am saying that it is a prime until I find out it is not

# checks to see if the number can be divided by a smaller number evenly
for factor in range(2, number_to_check // 2 + 1):
if number_to_check % factor == 0: # trying to see if there is a remainder after the divison and if it is equal to zero
is_prime = False # if it is equal to zero it is flase meaning it is not prime
break # again it means STOP
if is_prime: # after checking all
return f"{number_to_check} is a prime number."
else:
return f"{number_to_check} is not a prime number."

number = int(input("Enter a number to check to see if its prime: "))
print(find_primes(number))

```

## Explanation
My first thought was to use Javascript and html because those were the 2 languages that I was familiar with. I did some research and quickly came to the realization that html would not be the most effective. That's when I found out that I should use Python and Javascript.
Python is known for how easy it is to read and how simple it is. But is super space indentation sensitive. Whereas Javascript is a little more complex because it uses different characters, which makes it a little harder to understand.

Similarities: Both Javascript and Python are finding prime numbers between 2 and 100 even though in pyton it says 101. That is becuase we did not plug in 101 we stopped right before it.

Diffreneces: A diffrence that Javascript uses let for declaring variables while python uses simplier words becuase you do not need a keyword

9 changes: 9 additions & 0 deletions lesson_05/dasiaenglish/lesson_05.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## User Stories

# Shein app
-As a shopper I would like to virtually try on clothing items to see if they fit or not before purchasing.

-As a buyer I would like to know exaclty how much I am spending, with a recommendation on what is worth my dolor, by grouping clothes a certain way.


-giAs a fashionesta I want a personalized stylist to creat outfits with what is in my cart, that way I can mix and match my clothes.
22 changes: 11 additions & 11 deletions lesson_05/quiz/src/lesson5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
MultipleChoiceQuizQuestion,
QuizPrinter,
QuizQuestion,
} from "codedifferently-instructional";
} from "codedifferently-instructional"; //dasiaenglish

export class Lesson5 {
run(): void {
Expand Down Expand Up @@ -38,7 +38,7 @@ export class Lesson5 {
[AnswerChoice.C, "To insert an image"],
[AnswerChoice.D, "To create a paragraph"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.B,
);
}

Expand All @@ -52,7 +52,7 @@ export class Lesson5 {
[AnswerChoice.C, "alt"],
[AnswerChoice.D, "href"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.C,
);
}

Expand All @@ -66,7 +66,7 @@ export class Lesson5 {
[AnswerChoice.C, "<div>"],
[AnswerChoice.D, "<link>"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.B,
);
}

Expand All @@ -80,7 +80,7 @@ export class Lesson5 {
[AnswerChoice.C, "<span>"],
[AnswerChoice.D, "<br>"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.B,
);
}

Expand All @@ -94,7 +94,7 @@ export class Lesson5 {
[AnswerChoice.C, "Computer Style Sheets"],
[AnswerChoice.D, "Cascading System Sheets"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.B,
);
}

Expand All @@ -108,7 +108,7 @@ export class Lesson5 {
[AnswerChoice.C, "text-color"],
[AnswerChoice.D, "background-color"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.B,
);
}

Expand All @@ -122,7 +122,7 @@ export class Lesson5 {
[AnswerChoice.C, "/* this is a comment */"],
[AnswerChoice.D, "<!-- this is a comment -->"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.C,
);
}

Expand All @@ -136,7 +136,7 @@ export class Lesson5 {
[AnswerChoice.C, "text-size"],
[AnswerChoice.D, "text-style"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.B,
);
}

Expand All @@ -150,7 +150,7 @@ export class Lesson5 {
[AnswerChoice.C, "inline-block"],
[AnswerChoice.D, "none"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.B,
);
}

Expand All @@ -164,7 +164,7 @@ export class Lesson5 {
[AnswerChoice.C, "<stylesheet link='styles.css'>"],
[AnswerChoice.D, "<css href='styles.css'>"],
]),
AnswerChoice.UNANSWERED,
AnswerChoice.A,
);
}
}
Expand Down