-
Notifications
You must be signed in to change notification settings - Fork 25
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
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
76abc20
Prime numbers
Dasiame 2f1fb03
fixed my code to be any number
Dasiame f2665f4
added notes and deleted speaker option
Dasiame 49e7a01
user stories
Dasiame a9d03ad
change answers in quiz and made 3 user stories
Dasiame f225939
3 user stories
Dasiame 85ae4b4
extra credit quiz
Dasiame 80cea3f
Merge branch 'code-differently:main' into lesson_05
Dasiame 9833319
rm lesson_04 work
Dasiame f563e92
fix changes to lesson_05
Dasiame 5f7f48a
Merge branch 'code-differently:main' into lesson_05
Dasiame f4aaa36
Merge branch 'code-differently:main' into lesson_05
Dasiame 045b84a
chore: revert quiz before submit
anthonydmays File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
Dasiame marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.