forked from root/public
Compare commits
3 Commits
master
...
1148-conca
Author | SHA1 | Date |
---|---|---|
zainabdnaya | 3b79283e08 | 2 years ago |
zainabdnaya | 0747862ca0 | 2 years ago |
zainabdnaya | d76739cbf1 | 2 years ago |
54 changed files with 478 additions and 991 deletions
@ -1,43 +0,0 @@
|
||||
## add-if-positive |
||||
|
||||
### Instructions |
||||
Write a function that takes two numbers and adds them together if they are both positive. |
||||
- If either number is negative or one of them is negative and the other is positive return `0`. |
||||
|
||||
### Expected function |
||||
```go |
||||
func AddIfPositive(a int, b int) int { |
||||
// your code here |
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
func main() { |
||||
fmt.Println(AddIfPositive(1, 2)) |
||||
fmt.Println(AddIfPositive(1, -2)) |
||||
fmt.Println(AddIfPositive(-1, 2)) |
||||
fmt.Println(AddIfPositive(-1, -2)) |
||||
fmt.Println(AddIfPositive(10,20)) |
||||
fmt.Println(AddIfPositive(0,20)) |
||||
} |
||||
``` |
||||
|
||||
and the output should be: |
||||
|
||||
```console |
||||
$ go run . |
||||
3 |
||||
0 |
||||
0 |
||||
0 |
||||
30 |
||||
20 |
||||
``` |
@ -1,46 +0,0 @@
|
||||
## alpha-position |
||||
|
||||
### Instructions |
||||
|
||||
Write a function named `AlphaPosition` that takes an alphabetical character as a parameter and returns the position of the letter in the alphabet. |
||||
- If the character is not in the alphabet, return -1 |
||||
- If the character is in the alphabet, return the position of the letter in the alphabet |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func AlphaPosition(c rune) int { |
||||
// your code goes here |
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
func main(){ |
||||
fmt.Println(AlphaPosition('a')) |
||||
fmt.Println(AlphaPosition('z')) |
||||
fmt.Println(AlphaPosition('B')) |
||||
fmt.Println(AlphaPosition('Z')) |
||||
fmt.Println(AlphaPosition('0')) |
||||
fmt.Println(AlphaPosition(' ')) |
||||
} |
||||
``` |
||||
|
||||
And its output : |
||||
|
||||
```console |
||||
$ go run . | cat -e |
||||
1$ |
||||
26$ |
||||
2$ |
||||
26$ |
||||
-1$ |
||||
-1$ |
||||
``` |
@ -1,43 +0,0 @@
|
||||
## array-sum |
||||
|
||||
### Instructions |
||||
|
||||
Write a function that takes an array of numbers and returns the sum of all the numbers in the array. |
||||
- If the array is empty, the function should return 0. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func SumArray(numbers []int) int { |
||||
// your code here |
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import ( |
||||
"fmt" |
||||
) |
||||
|
||||
func main(){ |
||||
fmt.Println(SumArray([]int{1,2,3,4,5})) |
||||
fmt.Println(SumArray([]int{})) |
||||
fmt.Println(SumArray([]int{-1,-2,-3,-4,-5})) |
||||
fmt.Println(SumArray([]int{-1,2,3,4,-5})) |
||||
} |
||||
``` |
||||
|
||||
and the output should be: |
||||
|
||||
```console |
||||
$ go run . |
||||
15 |
||||
0 |
||||
-15 |
||||
3 |
||||
``` |
@ -1,38 +0,0 @@
|
||||
## ascii |
||||
|
||||
### Instructions |
||||
|
||||
Write a function that receives a string and returns a slice with the ASCII values of its characters. If the string is empty it should return an empty slice. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func Ascii(str string) []byte { |
||||
|
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import ( |
||||
"piscine" |
||||
"fmt" |
||||
) |
||||
|
||||
func main() { |
||||
l := piscine.Ascii("Hello") |
||||
fmt.Println(l) |
||||
} |
||||
``` |
||||
|
||||
And its output: |
||||
|
||||
```console |
||||
$ go run . |
||||
[104 101 108 108 111] |
||||
``` |
@ -1,46 +0,0 @@
|
||||
## between-us |
||||
|
||||
### Instructions |
||||
|
||||
Write a function named `BetweenUs` that takes 3 paramters and return : |
||||
- If the first paramter is between the second and third paramters, return **true** else return **false** |
||||
- If the second parameter is bigger than the third return **false** |
||||
|
||||
### Expected function |
||||
```go |
||||
func BetweenUs(num, min, max int) bool { |
||||
// Your code here |
||||
} |
||||
``` |
||||
|
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
func main(){ |
||||
fmt.Println(BetweenUs(1, 2, 3)) |
||||
fmt.Println(BetweenUs(1, 1, 3)) |
||||
fmt.Println(BetweenUs(1, 3, 3)) |
||||
fmt.Println(BetweenUs(1, 1, 1)) |
||||
fmt.Println(BetweenUs(1, 2, 1)) |
||||
fmt.Println(BetweenUs(-1, -10, 0)) |
||||
} |
||||
``` |
||||
|
||||
and the output should be: |
||||
|
||||
```console |
||||
$ go run . |
||||
false |
||||
true |
||||
false |
||||
true |
||||
false |
||||
true |
||||
``` |
@ -1,47 +0,0 @@
|
||||
## binary-addition |
||||
|
||||
### Instructions |
||||
|
||||
Write a function named `BinaryAddition(int,int)` that takes two integers and returns the sum of the two in binary in an array of `int`. |
||||
- If one of the integers is negative return `nil` |
||||
- Convert the argument to binary then add the two binary numbers together |
||||
|
||||
### Expected function |
||||
```go |
||||
func BinaryAddition(a int, b int) []int { |
||||
// your code here |
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
|
||||
func main(){ |
||||
fmt.Println(BinaryAddition(1, 1)) |
||||
fmt.Println(BinaryAddition(1, 2)) |
||||
fmt.Println(BinaryAddition(1, 3)) |
||||
fmt.Println(BinaryAddition(2, 1)) |
||||
fmt.Println(BinaryAddition(2, 2)) |
||||
fmt.Println(BinaryAddition(1, 16)) |
||||
} |
||||
``` |
||||
|
||||
and the output should be: |
||||
|
||||
```console |
||||
$ go run . |
||||
[1 0] |
||||
[1 1] |
||||
[1 0 0] |
||||
[1 1] |
||||
[1 0 0] |
||||
[1 0 1] |
||||
[1 0 0 0 1] |
||||
``` |
@ -1,30 +1,35 @@
|
||||
## clonernews |
||||
|
||||
### Objectives |
||||
Technology is a rapidly evolving sector. As a programmer, it is not always easy to keep up to date with every new advancement. |
||||
|
||||
Tech news (like Hacker News) is a really great way to keep up to date with the exponential evolution of technology, as well as tech jobs and much more. Some websites do not offer very appealing propositions to consume their media. |
||||
Technology nowadays continue to evolve. As a programmer or developer you must be updated with this exponential evolution of technology. |
||||
|
||||
So your objective for this raid is to create an UI for the [HackerNews API](https://github.com/HackerNews/API). |
||||
This is where tech news shines, just like Hacker News where you can see all about new technology, jobs and much more, but some websites do not perform very well or their are not so appealing. |
||||
|
||||
So your objective for this raid is to create an UI for [`HackerNewsAPI`](https://github.com/HackerNews/API). |
||||
|
||||
You must handle at least: |
||||
- Posts: including: |
||||
|
||||
- Posts, this includes : |
||||
- [stories](https://github.com/HackerNews/API#ask-show-and-job-stories) |
||||
- [jobs](https://github.com/HackerNews/API#ask-show-and-job-stories) |
||||
- [polls](https://github.com/HackerNews/API#items) |
||||
- [comments](https://github.com/HackerNews/API#items): each comment must have the proper post parent. |
||||
- [comments](https://github.com/HackerNews/API#items), each comment must have the proper post parent. |
||||
|
||||
Post and comments must be ordered by newest post to oldest. |
||||
You must not load all posts at once, so that you only load posts once the users need to see more posts. This can be done with the help of [events](https://developer.mozilla.org/en-US/docs/Web/Events). |
||||
You must not load all posts at once. You must be able to load posts when ever the users need to see more posts. This can be done with the help of [event](https://developer.mozilla.org/en-US/docs/Web/Events). |
||||
|
||||
[Live Data](https://github.com/HackerNews/API#live-data) : is one of the features from this Hacker News API, you can handle requests so that the news you provide are updated. |
||||
|
||||
- You must have a section that present the newest information. You will have to notify the user at least every 5 seconds, whenever the live data is updated. In other words, after every 5 seconds if a change was made in the live data, you have to notify the user. |
||||
|
||||
The point of the project is to keep users updated, so we'll need to inform our users of changes to the data using [Live Data](https://github.com/HackerNews/API#live-data). Create a section that presents the newest information. You'll need to notify the user at least every 5 seconds, whenever the live data is updated. |
||||
Currently this API does not present [rate limit](https://en.wikipedia.org/wiki/Rate_limiting). But that does not mean you should abuse/overload the API!!! |
||||
|
||||
Currently this API does not present a [rate limit](https://en.wikipedia.org/wiki/Rate_limiting), but that does not mean that you should abuse or overload the API. |
||||
Best ways you can avoid rate limiting : |
||||
|
||||
Best ways you can avoid rate limiting: |
||||
- optimize your code to eliminate any unnecessary requests |
||||
- usage of a throttling/debouncing function to regulate the number of requests, |
||||
- usage of throttling/debouncing function to regulates the amount of requests |
||||
|
||||
### Optional |
||||
|
||||
You can handle sub-comments for stories, jobs and polls, by implementing nested comments. |
||||
You can handle sub-comments for each stories, jobs and polls this meaning nested comments |
||||
|
@ -0,0 +1,20 @@
|
||||
## Concat2Argument |
||||
|
||||
### Instructions |
||||
|
||||
Write a program that concatenates two arguments and prints the result: |
||||
- If the number of arguments is not 2, print (`'\n'`). |
||||
- don't concatenate the two arguments with space. |
||||
|
||||
### Usage |
||||
|
||||
```console |
||||
$ go run . | cat -e |
||||
$ |
||||
$ go run . "Hello" "World!" | cat -e |
||||
HelloWorld!$ |
||||
$ go run . " student " talented | cat -e |
||||
student talented$ |
||||
$ go run . "Hello" "student" talented ! | cat -e |
||||
$ |
||||
``` |
@ -1,40 +0,0 @@
|
||||
## count-negative |
||||
|
||||
### Instructions |
||||
|
||||
Write a function that takes an array of integers and returns the number of negative numbers in the array. |
||||
- If the array is empty, the function should return `0`. |
||||
|
||||
### Expected function |
||||
```go |
||||
func CountNegative(numbers []int) int { |
||||
// your code here |
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
func main(){ |
||||
fmt.Println(CountNegative([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})) |
||||
fmt.Println(CountNegative([]int{-1, -2, -3, -4, -5, -6, -7, -8, -9, -10})) |
||||
fmt.Println(CountNegative([]int{})) |
||||
fmt.Println(CountNegative([]int{-1,2,0,-3})) |
||||
} |
||||
``` |
||||
|
||||
and the output should be: |
||||
|
||||
```console |
||||
$ go run . |
||||
0 |
||||
10 |
||||
0 |
||||
2 |
||||
``` |
@ -1,41 +0,0 @@
|
||||
## Devisor |
||||
|
||||
### Instructions |
||||
|
||||
Write a function that takes a positive integer and returns the number of it's devisors. |
||||
- If the the number a is negative return 0. |
||||
- Test numbers from 0 to 99999999 . |
||||
|
||||
### Expected function |
||||
```go |
||||
func Divisors(n int) int { |
||||
... |
||||
} |
||||
``` |
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import ( |
||||
"fmt" |
||||
"piscine" |
||||
) |
||||
|
||||
func main() { |
||||
fmt.Println(piscine.Divisors(4))// 4 can be divided by 1 and 2 and 4 |
||||
fmt.Println(piscine.Divisors(5))//5 can be divided by 1 and 5 |
||||
} |
||||
|
||||
``` |
||||
|
||||
And its output : |
||||
|
||||
|
||||
```console |
||||
$ go run . |
||||
3 |
||||
2 |
||||
``` |
@ -1,25 +0,0 @@
|
||||
## get-area |
||||
|
||||
### Instructions |
||||
|
||||
Write a program that takes a positive number as radius and prints the area of a circle. |
||||
- The area of the circle is `3.14` times the radius squared. |
||||
- Only positive numbers will be accepted, otherwise print `Error` followed by (`'\n'`) |
||||
- If the number of arguments is not `1` print (`'\n'`) |
||||
- The output must be an integer. |
||||
|
||||
|
||||
### Usage |
||||
|
||||
```console |
||||
$ go run . | cat -e |
||||
$ |
||||
$ go run . 10 | cat -e |
||||
314$ |
||||
$ go run . 4 | cat -e |
||||
50$ |
||||
$ go run . -10 | cat -e |
||||
Error$ |
||||
$ go run . "Hello World!" | cat -e |
||||
Error$ |
||||
``` |
@ -1,45 +0,0 @@
|
||||
## common-multiples |
||||
|
||||
### Instructions |
||||
|
||||
Write a function to check whether a given non-negative number is a multiple of 3 or 7. |
||||
- If the number is a multiple of 3 or 7, return `true`. |
||||
- If the number is not a multiple of 3 or 7, return `false`. |
||||
- If the number is less or equal to 0, return `false`. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func IsMultiple(number int) bool { |
||||
// Your code here |
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
func main() { |
||||
fmt.Println(IsMultiple(3)) |
||||
fmt.Println(IsMultiple(7)) |
||||
fmt.Println(IsMultiple(8)) |
||||
fmt.Println(IsMultiple(9)) |
||||
fmt.Println(IsMultiple(-1)) |
||||
} |
||||
``` |
||||
|
||||
and the output should be: |
||||
|
||||
```console |
||||
$ go run . |
||||
true |
||||
true |
||||
false |
||||
true |
||||
false |
||||
``` |
@ -1,41 +0,0 @@
|
||||
## leap-year |
||||
|
||||
### Instructions |
||||
|
||||
Write a function named `LeapYear(int)` that takes a year as a parameter and returns true if the year is a leap year and false otherwise. |
||||
- A leap year is a year divisible by 4, but not by 100. |
||||
- A leap year is also divisible by 400. |
||||
- If the number is not positive, return false |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func LeapYear(year int)bool{ |
||||
// your code here |
||||
} |
||||
``` |
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
func main(){ |
||||
fmt.Println(LeapYear(2020)) |
||||
fmt.Println(LeapYear(2021)) |
||||
fmt.Println(LeapYear(2022)) |
||||
fmt.Println(LeapYear(-10)) |
||||
} |
||||
``` |
||||
and the output should be: |
||||
|
||||
``` console |
||||
$ go run . | cat -e |
||||
true$ |
||||
false$ |
||||
false$ |
||||
false$ |
||||
``` |
@ -1,20 +0,0 @@
|
||||
## param-range |
||||
|
||||
### instructions |
||||
|
||||
Write a program that takes a number in the arguments and prints the max and min. |
||||
- If the number of arguments is less than 2 print (`'\n'`) |
||||
- If one of the arguments is not a number, print (`"Error\n"`) |
||||
- The output should be space-separated and (`'\n'`) at the end. |
||||
|
||||
### Usage |
||||
```console |
||||
$ go run . | cat -e |
||||
$ |
||||
$ go run . 1 2 3 4 5 6 7 8 9 | cat -e |
||||
1 9$ |
||||
$ go run . "-1" "1" | cat -e |
||||
-1 1$ |
||||
$ go run . 1 a 2 3 4 5 6 7 8 9 | cat -e |
||||
Error$ |
||||
``` |
@ -1,23 +0,0 @@
|
||||
## print-ascii |
||||
|
||||
### Instructions |
||||
|
||||
Write a program that prints the ASCII value of a letter passed in the command line |
||||
- If the argument is not a letter nothing will be printed |
||||
- if the number of arguments is not 1 then nothing will be printed |
||||
|
||||
### Usage |
||||
|
||||
```console |
||||
$ go run . |
||||
$ go run . a |
||||
97 |
||||
$ go run . 'A' |
||||
65 |
||||
$ go run . 'z' |
||||
122 |
||||
$ go run . Z |
||||
90 |
||||
$ go run . 1 |
||||
$ go run . "Hello" "Word" |
||||
``` |
@ -1,27 +0,0 @@
|
||||
## rot-arg-n |
||||
|
||||
### Instructions |
||||
|
||||
Write a program that takes arguments from the command line and rotates them by the number in the first argument. |
||||
- If the number of arguments is less than 3 print (`'\n'`) |
||||
- If the first argument is not a number, the program should print `"Error\n"` |
||||
- If the first argument is negative, the program should print `"Error\n"` |
||||
- If the first argument is zero, the program should print the original arguments |
||||
- Prints the rotated arguments with a space between each argument and a newline at the end. |
||||
|
||||
### Usage |
||||
|
||||
```console |
||||
$ go run . | cat -e |
||||
$ |
||||
$ go run . 1 2 3 4 5 | cat -e |
||||
3 4 5 2$ |
||||
$ go run . 2 "Hello" "World" | cat -e |
||||
Hello World$ |
||||
$ go run . -1 2 3 4 5 | cat -e |
||||
Error$ |
||||
$ go run . 0 2 3 4 5 | cat -e |
||||
2 3 4 5$ |
||||
$ go run . 3 "Hello" "World" | cat -e |
||||
World Hello$ |
||||
``` |
@ -1,57 +1,57 @@
|
||||
#### Functional |
||||
#### Functionals |
||||
|
||||
###### Does the data appear in a `<table>` element? |
||||
###### Does the data appear in a table element? |
||||
|
||||
###### Does the table present just the required data (icon, name, full name, power stats, race, gender, height, weight, place of birth, alignment), instead of all of it? |
||||
###### Does the table presents just the requested data (icon, name, full name, powerstats, race, gender, height, weight, place of birth, alignment), instead of all of it? |
||||
|
||||
###### Has client-side pagination been implemented? Are there different pages that display different information? |
||||
###### Are there different pages that display different information? |
||||
|
||||
###### Does the table initially displays 20 results? |
||||
###### Can you change the amount of results displayed between **10**, **20**, **50**, **100** or **all results**? |
||||
|
||||
###### Can you change the page size to one of **10**, **20**, **50**, **100** or **all results**? |
||||
###### Does the table initially displays 20 results? |
||||
|
||||
###### Are the results initially sorted by the **name** column in **ascending** order? |
||||
###### Are the results initially sorted by the column **name** by **ascending** order? |
||||
|
||||
###### Are all columns of the table clickable in order to sort the results? |
||||
|
||||
##### Try to click once to sort the table by weight. |
||||
|
||||
###### Was the table sorted numerically by weight in **ascending** order? (be aware that cases like [75 kg, 100kg] should be in that order and not the other way around) |
||||
###### Did the results became sorted numerically by weight in **ascending** order? (be aware that cases like [75 kg, 100kg] should be in that order and not the other way around) |
||||
|
||||
##### Try to click twice to sort the table by place of birth. |
||||
##### Try to click twice to sort the by place of birth. |
||||
|
||||
###### Were the results sorted alphabetically by place of birth in **descending** order? |
||||
###### Did the results became sorted alphabetically by place of birth in **descending** order? |
||||
|
||||
##### Try to click several times on a column and observe its behavior. |
||||
|
||||
###### Did the sort order toggle between **ascending** and **descending** order? |
||||
###### Did the results became sorted in **ascending** and **descending** order, alternately? |
||||
|
||||
##### Try to search for `Superman`. |
||||
|
||||
###### Are the missing values always shown last? |
||||
|
||||
##### Write only `Cat` on the search field. |
||||
###### As you type, does the results on the table change? |
||||
|
||||
###### As you type, do the results on the table change? |
||||
##### Write only `Cat` on the search field. |
||||
|
||||
###### Does Catwoman appear in the results? |
||||
###### Does Catwoman appear on the results? |
||||
|
||||
###### Does the project contains the use of `fetch`? |
||||
|
||||
##### Check the project to ensure that it does not use any libraries of frameworks (React, Vue, Svelte etc). |
||||
|
||||
###### Is the project free of any frameworks or librairies? |
||||
###### Confirm that no frameworks or librairies where used |
||||
|
||||
#### Bonus |
||||
|
||||
###### +Can you search for any fields apart from the name? |
||||
|
||||
###### +Can you do a search with search these search operators: include/exclude for strings and equal/not equal/greater than/less than)? |
||||
###### +Can you do a search with search operators (include/exclude for strings and equal/not equal/greater than/lesser than)? |
||||
|
||||
###### +If you click on a hero, does the site display the details and a large image of it? |
||||
###### +If you click on a hero, does the site displays the details and a large image of it? |
||||
|
||||
###### +Does the URL change when you make a search? |
||||
###### +Does the URL changes when you make a search? |
||||
|
||||
###### +After making a search and the URL changes, if you copy and paste it to a different tab, are the results displayed in the table the same as the ones from the previous tab? |
||||
###### +After making a search and the URL changes, if you copy and paste it in a different window, are the results displayed in the table the same as the ones from the search? |
||||
|
||||
###### +Does the project run quickly and effectively? (Favoring recursive, no unnecessary data requests, etc)? |
||||
###### +Does the project runs quickly and effectively? (Favoring recursive, no unnecessary data requests, etc) |
||||
|
||||
###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices/README.md)? |
||||
|
Loading…
Reference in new issue