These are chat archives for FreeCodeCamp/Help

15th
Jul 2018
Tyriq Riggins
@jiggyriggy65
Jul 15 2018 00:01
i just found it out i had to add a .red-text selector in my css thank you though sir :)
Kyle Holm
@thekholm80
Jul 15 2018 00:01
:+1:
Hristina
@kika97_gitlab
Jul 15 2018 00:22
Hello everyone
Sorry for disturbing you but I need your help if you can give me advice?
Kyle Holm
@thekholm80
Jul 15 2018 00:23
?
Hristina
@kika97_gitlab
Jul 15 2018 00:24
I am new in coding so I have an exam for c programming language, and I don't know how to start which is the best advice given from you to learn fast in coding. ps.Sorry for my language.
Kyle Holm
@thekholm80
Jul 15 2018 00:24
i suppose that depends on how much C you need to learn and how fast you need to learn it
Karma Drukpa
@coderkarma
Jul 15 2018 00:25
question
Hristina
@kika97_gitlab
Jul 15 2018 00:25
I have one month to prepare.
Karma Drukpa
@coderkarma
Jul 15 2018 00:25
need some thoughts
Kyle Holm
@thekholm80
Jul 15 2018 00:25
if you just need to do a Hello, World app then you can probably learn that in about 10 minutes from 1000 different online resources
@coderkarma The Holy Roman Empire was neither holy nor Roman nor an empire.
that kind of thought?
Karma Drukpa
@coderkarma
Jul 15 2018 00:27
hahah
was about to ask some approaches to this question
arr given [ 1,4, 9, 12] , need to find the ranking accordingly
like [ 4, 3 2 1]
i had to find the ranking .
loop through an array, but here my logic is kinda blank
while comparing each element
Nabil Tharwat
@KL13NT
Jul 15 2018 00:30
Well, I guess you could use a for loop with conditionals to compare each pair of values
Kyle Holm
@thekholm80
Jul 15 2018 00:31
@coderkarma what do you mean by "ranking"?
Karma Drukpa
@coderkarma
Jul 15 2018 00:31
give number according to ranking
like above ex. 12 is highest
so it is 1
Kyle Holm
@thekholm80
Jul 15 2018 00:32
are you allowed to use sort()?
Karma Drukpa
@coderkarma
Jul 15 2018 00:32
yes
i thought that to
to sort the arra
[ 1,4, 9, 12] , this would be output
[ 4, 3 2 1]
same position
with sorting i could make it in order right
if i sort the position of element changes
Kyle Holm
@thekholm80
Jul 15 2018 00:34
wait, so [ 1,4, 9, 12] should return [4, 3, 2, 1]?
Karma Drukpa
@coderkarma
Jul 15 2018 00:34
yes
Kyle Holm
@thekholm80
Jul 15 2018 00:34
so you probably don't want to sort then
Karma Drukpa
@coderkarma
Jul 15 2018 00:35
since 12 is highest, 9 is second highest and 4 is 3rd highest
how can compare each element ?
after looping through
Kyle Holm
@thekholm80
Jul 15 2018 00:36
oh, i think i've got it
Karma Drukpa
@coderkarma
Jul 15 2018 00:36
damnn,, your brain... is different
Kyle Holm
@thekholm80
Jul 15 2018 00:36
just practice
so here's what i thought
given [1 ,4, 9, 12] how can we know what the ranking should be?
i figure, if you copy the array and sort it descending, then you can use the indexes of the sorted array as the rank. then you just loop through the original array and create your result using the sorted indexes
Karma Drukpa
@coderkarma
Jul 15 2018 00:41
How can i use indexes of sorted array as the rank?
Kyle Holm
@thekholm80
Jul 15 2018 00:41
well, technically it would have to be index + 1, since arrays are 0 indexed
Karma Drukpa
@coderkarma
Jul 15 2018 00:42
let me try it and see how that goes.
Kyle Holm
@thekholm80
Jul 15 2018 00:47
bleh i wish there were an easy way to explain this
Karma Drukpa
@coderkarma
Jul 15 2018 00:57
function rankings(arr){
  let position = [];
  let newArr = arr.slice();
   newArr.sort(function(a,b){
       return b - a;
    });

    for (let i = 0; i < arr.length; i += 1){
         let indexes = newArr[i + 1]
         position.push(indexes);
    }
   return position;
}
Kyle Holm
@thekholm80
Jul 15 2018 00:57
close
let indexes = newArr[i + 1] this isn't quite what you want
the rest looks pretty good
Karma Drukpa
@coderkarma
Jul 15 2018 00:58
i want that to be position of old array
Kyle Holm
@thekholm80
Jul 15 2018 00:59
i think what you need is indexOf(), since you're using the index of the sorted array to figure out the rank
Kyle Holm
@thekholm80
Jul 15 2018 01:17
@coderkarma get it?
Karma Drukpa
@coderkarma
Jul 15 2018 01:18
not yet
if(newArr.indexOf(arr[i]) > - 1){
position.push(i + 1);
}
Kyle Holm
@thekholm80
Jul 15 2018 01:19
what does newArr.indexOf() give you?
Karma Drukpa
@coderkarma
Jul 15 2018 01:20
it gives us sorted indexes right
Kyle Holm
@thekholm80
Jul 15 2018 01:20
right, which is a good thing
since you sorted the array, the index + 1 is the rank, right?
so don't you want to push that rank to your position array?
Karma Drukpa
@coderkarma
Jul 15 2018 01:22
How index + 1 WOULD BE rank?
Kyle Holm
@thekholm80
Jul 15 2018 01:23
so assuming your input is [1, 4, 9, 12]
Karma Drukpa
@coderkarma
Jul 15 2018 01:23
yes
Kyle Holm
@thekholm80
Jul 15 2018 01:23
sorted is [12, 9, 4, 1]
Karma Drukpa
@coderkarma
Jul 15 2018 01:23
correct
Kyle Holm
@thekholm80
Jul 15 2018 01:23
sorted.indexOf(12) is 0
because 12 is in the 0 index
Karma Drukpa
@coderkarma
Jul 15 2018 01:23
that's true
Kyle Holm
@thekholm80
Jul 15 2018 01:24
if you add 1 to 0, that gives you 1
so 12 is rank 1
sorted.indexOf(4) + 1 = 3
etc
Karma Drukpa
@coderkarma
Jul 15 2018 01:25
wait!!!
[10, 5, 20] if this is our input, then output suppose to be like this [2, 1, 3 ] right
so we don't need to make check there while doing indexOf
Kyle Holm
@thekholm80
Jul 15 2018 01:29
that's not how you explained the problem to me
Karma Drukpa
@coderkarma
Jul 15 2018 01:29
Sorry...
Kyle Holm
@thekholm80
Jul 15 2018 01:29
you said [10, 5, 20] should return [2, 3, 1]
since 20 is highest and 5 is lowest
Karma Drukpa
@coderkarma
Jul 15 2018 01:31
wait... yes 20 is highest , 10 is second highest and 5 is third highest but we need to rank them according to its position
I mean in their respective position
Kyle Holm
@thekholm80
Jul 15 2018 01:37
their respective position in what?
Karma Drukpa
@coderkarma
Jul 15 2018 01:42
according to rank
([4, 2, 3, 1]); // [1, 3, 2, 4]
Kyle Holm
@thekholm80
Jul 15 2018 01:43
i guess i don't understand. if [1, 4, 9, 12] should return [4, 3, 2, 1] but [10, 5, 20] should return [2, 1, 3] then i have no clue what you're doing
Karma Drukpa
@coderkarma
Jul 15 2018 01:43
([6, 8, 1, 12, 4, 3, 9]); // [4, 3, 7, 1, 5, 6, 2]
Kyle Holm
@thekholm80
Jul 15 2018 01:46

okay, so i do understand ... you must have mispoke when you said

[10, 5, 20] if this is our input, then output suppose to be like this [2, 1, 3 ] right

Karma Drukpa
@coderkarma
Jul 15 2018 01:47
that's right. sorry for not explaining clearly.
that is precise output what we suppose to get.
[6, 8, 1, 12, 4, 3, 9]); // [4, 3, 7, 1, 5, 6, 2]
Kyle Holm
@thekholm80
Jul 15 2018 01:48
right
Lorrie Pearson
@Lorrie01
Jul 15 2018 02:07

Working on: Basic Data Structures: Create complex multi-dimensional arrays
here is the link: https://bit.ly/2Lhl3ue
I'm getting 4/5 challenge goals correct except for :

myNestedArray should contain only numbers, booleans, and strings as data elements

here is my code:

let myNestedArray = [
  // change code below this line
  true, false, 1, 2, 3,  'hello world'
  [1, false, 6, 7, 'my world', true],
  [
    ['deep']
  ],
  [
    [
      ['deeper']
    ],
    [
      [
        ['deepest']
      ]
    ]
  ]


  // change code above this line
];

I'm not sure what I'm doing wrong.

If someone is available to assist, I'd appreciate it.
Thanks

Kyle Holm
@thekholm80
Jul 15 2018 02:10
@Lorrie01 that's pretty weird. i removed all of the garbage (numbers, booleans, 'hello world', etc) and it passed
but i don't see why your code didn't
Alexander R Bott
@Abott1222
Jul 15 2018 02:11
@thekholm80 yo I wanted to show you this. I have been looking for a program like this for a long time!
Kyle Holm
@thekholm80
Jul 15 2018 02:11
@Abott1222 those CS50 courses are :fire:
Alexander R Bott
@Abott1222
Jul 15 2018 02:11
What you'll learn
Git
HTML, CSS
Flask
SQL
APIs
JavaScript
Front Ends
Django
Testing, CI/CD
Scalability
Security
since we were talking about django and flask but this one seems really advanced
Kyle Holm
@thekholm80
Jul 15 2018 02:12
i really like the way David Malan (Milan?) teaches
Alexander R Bott
@Abott1222
Jul 15 2018 02:12
idk if you have time but I will start it soon so if you do decide to go through it you can shoot me your questions and hopefully I can ask you as well :D
Lorrie Pearson
@Lorrie01
Jul 15 2018 02:13
thanks @thekholm80
Kyle Holm
@thekholm80
Jul 15 2018 02:13
@Lorrie01 did you get it to pass?
@Abott1222 i don't think i'm going to go through it right now, but it's on my list for sure
Lorrie Pearson
@Lorrie01
Jul 15 2018 02:14
I got it to pass! Thanks @thekholm80
Kyle Holm
@thekholm80
Jul 15 2018 02:16
:tada: great
Kyle Holm
@thekholm80
Jul 15 2018 03:46
@coderkarma did you get it sorted out?
Bud Fields
@TheTennesseePro_twitter
Jul 15 2018 04:30
Sorry, just found this room. I signed up, paid for, and have been involved with this course. Now Udemy says I must pay again. Is this normal? Any suggestions?
Karma Drukpa
@coderkarma
Jul 15 2018 05:27
nope @thekholm80
not yet
Nazar
@IsaakNazar
Jul 15 2018 06:06
@moigithub thank you so much :thumbsup:
Momoko_W
@MomokoW
Jul 15 2018 07:30
把你的a元素的href属性的值替换为一个#,别名hash(哈希)符号,将其变为一个固定链接。这是什么意思
Henry
@GitHub-Henry
Jul 15 2018 07:48
May Kittens Devour Your Soul
@diomed
Jul 15 2018 08:39
1 for @thekholm80
Praveen Saraogi
@saraogipraveen
Jul 15 2018 10:06
can anyone suggest me best, cheap and reliable hosting and domain provider
Momozor
@momozor
Jul 15 2018 10:23
@raviloop DigitalOcean
Anand Potukuchi
@anandpotukchi
Jul 15 2018 11:49
@raviloop TRY namecheap or 1&1
Anand Potukuchi
@anandpotukchi
Jul 15 2018 11:56
hi people
are any of the chslenges in the main curriculum still untested or not working?
alpox
@alpox
Jul 15 2018 12:47
@anandpotukchi Some can have some problems
Anand Potukuchi
@anandpotukchi
Jul 15 2018 13:09
had to reload the page
worked after that
Kyle Holm
@thekholm80
Jul 15 2018 13:13
@diomed lol
NomanBashir133
@NomanBashir133
Jul 15 2018 13:51
Hi, I am looking for some open source project to contribute. I have worked in angular, reactjs nodejs. Any contributor who can recommend me some projects where help is required?
Anand Potukuchi
@anandpotukchi
Jul 15 2018 13:56
image.png
what's
wrong wth this?
NomanBashir133
@NomanBashir133
Jul 15 2018 14:19
I would have created a two dimensional array of list of tasks like array = [["task one" , "task two"] , ["one task" , "two task"]] and then would have used MAP function to call List component so that I can add as many as lists as possible without duplicating code passing list with declaring it.
alpox
@alpox
Jul 15 2018 14:24
@anandpotukchi You should remove the whitespace before the comma
Anand Potukuchi
@anandpotukchi
Jul 15 2018 15:03
@alpox in which line?
NomanBashir133
@NomanBashir133
Jul 15 2018 15:07
@anandpotukchi line 3
Anand Potukuchi
@anandpotukchi
Jul 15 2018 15:09
nope
no diffwerence
assing tests
*passing
but nit passinfg the challege
alpox
@alpox
Jul 15 2018 16:13
@anandpotukchi What does your code look like
Anand Potukuchi
@anandpotukchi
Jul 15 2018 16:17
```
const List= (props) => {
  { /* change code below this line */ }
    <p>{props.tasks.join(', ')}</p>
  { /* change code above this line */ }
};

class ToDo extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <h1>To Do Lists</h1>
        <h2>Today</h2>
        { /* change code below this line */ }
        <List tasks={["green", "blue", "red"]}  />
        <h2>Tomorrow</h2>
        <List tasks={["green", "blue", "red"]}  />
        { /* change code above this line */ }
      </div>
    );
  }
};
alpox
@alpox
Jul 15 2018 16:23
@anandpotukchi You do not return the <p> from the List function
You changed too much from the original code
Anand Potukuchi
@anandpotukchi
Jul 15 2018 16:29
what do i do now
this is the default:
const List= (props) => {
  { /* change code below this line */ }
  return <p>{}</p>
  { /* change code above this line */ }
};

class ToDo extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <h1>To Do Lists</h1>
        <h2>Today</h2>
        { /* change code below this line */ }
        <List/>
        <h2>Tomorrow</h2>
        <List/>
        { /* change code above this line */ }
      </div>
    );
  }
};
Moisés Man
@moigithub
Jul 15 2018 16:34
add return keyword before <p> (line 3)
Anand Potukuchi
@anandpotukchi
Jul 15 2018 16:35
thanks so much @moigithub
has the camper bit stopped giving brownie points?
Kyle Holm
@thekholm80
Jul 15 2018 16:36
cbot died
Moisés Man
@moigithub
Jul 15 2018 16:36
yep bot dead, since new curriculum went live
Kyle Holm
@thekholm80
Jul 15 2018 16:36
rip in peace
Anand Potukuchi
@anandpotukchi
Jul 15 2018 16:38
very sad
I liked it so much
RIP camperBot
Ene Catalin
@EneCatalin
Jul 15 2018 17:05
new curriculum ?
Kyle Holm
@thekholm80
Jul 15 2018 17:16
@EneCatalin you haven't been to freecodecamp.org in a while?
Ene Catalin
@EneCatalin
Jul 15 2018 17:16
couple months I think
Kyle Holm
@thekholm80
Jul 15 2018 17:16
it's all new
Ene Catalin
@EneCatalin
Jul 15 2018 17:20
checked it out
it's really nice
Kyle Holm
@thekholm80
Jul 15 2018 17:21
much more stuff to learn, for sure
Ene Catalin
@EneCatalin
Jul 15 2018 17:33
yeah
it legit rocks
May Kittens Devour Your Soul
@diomed
Jul 15 2018 20:33
lol, do people help people here anymore?
alpox
@alpox
Jul 15 2018 20:57
@diomed sure
Smootimus
@Smootimus
Jul 15 2018 21:30
Didn't know cbot went down
1LifeLess
@1LifeLess
Jul 15 2018 21:47
Hi, on JS is there a way to write Shorted IF which is not a part of a "Return"?
Kyle Holm
@thekholm80
Jul 15 2018 22:19
@1LifeLess what do you mean by "Shorted IF"?
@Smootimus you look different, are you feeling okay?
Karma Drukpa
@coderkarma
Jul 15 2018 23:10
need help for this problem my logic seems not working
function canSellTickets(people){
    if ( people === []){
         return 'YES';
        }
    for (let i = 0; i < people.length; i += 1){
        let person = people[i];
        let nextPerson = people[i + 1];
         if (person !== '25' && person >= '100' || person !== '50' ){
           return 'NO';
        } 
    }
    return 'YES';

}
Kyle Holm
@thekholm80
Jul 15 2018 23:22
instead of looking ahead, why don't you track how much money the clerk currently has?
Karma Drukpa
@coderkarma
Jul 15 2018 23:22
clerk has no money
Kyle Holm
@thekholm80
Jul 15 2018 23:22
not for the first customer
but after he sells 1 ticket he has $25
then if the next person has $25 the clerk will have $50
Karma Drukpa
@coderkarma
Jul 15 2018 23:23
right
Kyle Holm
@thekholm80
Jul 15 2018 23:24
but you're not tracking that
Karma Drukpa
@coderkarma
Jul 15 2018 23:26
so , clerk do have $25 bill in the begnning?
This message was deleted
Kyle Holm
@thekholm80
Jul 15 2018 23:29
the clerk has 0 at that beginning
imagine tickets([25, 25, 50])
the first person has $25
Karma Drukpa
@coderkarma
Jul 15 2018 23:29
ok
Kyle Holm
@thekholm80
Jul 15 2018 23:29
clerk has 0
clerk gives person a ticket, person gives clerk $25
now clerk has $25
Karma Drukpa
@coderkarma
Jul 15 2018 23:30
right
Kyle Holm
@thekholm80
Jul 15 2018 23:30
second person has $25
clerk gives person ticket, person gives clerk $25
now clerk has $50
Karma Drukpa
@coderkarma
Jul 15 2018 23:30
true
Kyle Holm
@thekholm80
Jul 15 2018 23:30
third person has 50
clerk gives person ticket, person gives clerk $50
clerk gives person $25 in change
clerk sells to all customers
Karma Drukpa
@coderkarma
Jul 15 2018 23:31
that's right
Kyle Holm
@thekholm80
Jul 15 2018 23:31
do you see why you need to track how much money the clerk has?
Karma Drukpa
@coderkarma
Jul 15 2018 23:32
yes
Kyle Holm
@thekholm80
Jul 15 2018 23:32
:+1:
Karma Drukpa
@coderkarma
Jul 15 2018 23:32
if person has 100 bil then she can't sell ticket since she won't have enough change right.
Kyle Holm
@thekholm80
Jul 15 2018 23:33
assuming our above scenario, if there were a 4th person in line tickets([25, 25, 50, 100]) with $100 then yes, because the clerk would have $75 at that point
but if it were tickets([25, 25, 100]) then no
Karma Drukpa
@coderkarma
Jul 15 2018 23:34
right
Kyle Holm
@thekholm80
Jul 15 2018 23:35
so all that i wrote above describes how you could use a loop to solve this problem
Karma Drukpa
@coderkarma
Jul 15 2018 23:36
ok.
Thanks
now i would loop through the people array
Kyle Holm
@thekholm80
Jul 15 2018 23:37
right
Karma Drukpa
@coderkarma
Jul 15 2018 23:48
just thinking what check should I do.
Smootimus
@Smootimus
Jul 15 2018 23:56
Yeah I'm feelin' 100
Kyle Holm
@thekholm80
Jul 15 2018 23:56
just giving you crap
noticed you updated your pic
Smootimus
@Smootimus
Jul 15 2018 23:57
;)