Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 2020 20:09
    @krisb1220 banned @Gastony
  • May 14 2020 22:38
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:37
    @bjorno43 banned @real-action
  • Feb 01 2020 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 2020 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:09
    thecodingaviator commented #31179
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:07
    thecodingaviator commented #31182
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator commented #31190
  • Apr 01 2019 18:05
    thecodingaviator commented #31157
  • Apr 01 2019 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

tiger500
@tiger500

function convertToF(celsius) {
var fahrenheit=0;

// Only change code below this line
fahrenheit=(-30+8);
fahrenheit=(-10+24);

// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);

Ednor
@ednor
@Chrono79 what about Strokes = Par, does that mean Par = 0 ?
There is column where Par has any value
tiger500
@tiger500

@kumquatfelafel function convertToF(celsius) {
var fahrenheit=0;

// Only change code below this line
fahrenheit=(-30+8);
fahrenheit=(-10+24);

// Only change code above this line
return fahrenheit;
}

// Change the inputs below to test your code
convertToF(30);

Diego Mayer
@Chrono79

@ednor

@ednor When strokes === par, you return "Par". for example

Strokes        Return
1        "Hole-in-one!"
<= par - 2        "Eagle" //you compare strokes against par - 2 here, using <=
par - 1        "Birdie"
par        "Par"
par + 1        "Bogey"
par + 2        "Double Bogey"
= par + 3        "Go Home!"
kumquatfelafel
@kumquatfelafel
@tiger500 alright. Well you're not using the conversion formula here. You're just hardcoding values. You need to use the formula. So what's the formula to convert celsius to fahrenheit?
tiger500
@tiger500
@kumquatfelafel celsius9/5+2
Ednor
@ednor
@Chrono79, in this challenge, I must use if ... return; else if (*n) ... return; and else ... return;
kumquatfelafel
@kumquatfelafel
@tiger500 the formula we use to convert fahrenheit to celsius is Fº = Cº * 9/5 + 32.
Diego Mayer
@Chrono79
@ednor yes, all the if/else you need to address all cases
kumquatfelafel
@kumquatfelafel
@tiger500 do you have a variable that represents the temperature in Fº in your code?
Ednor
@ednor
@Chrono79 ,here is what i've tried, but failed

function golfScore(par, strokes) {
  // Only change code below this line

  if (par > 1) {
    return "Hole-in-one";
  } else if (par <= -2) {
    return "Eagle";
  } else if (par <= -1) {
    return "Birdie";
  } else if (par >= 1) {
    return "Par";
  } else if (par >= 1) {
    return "Bogey";
  } else if (par >= 2) {
    return "Double Bogey";
  } else if (par >= 3) {
    return "Go Home!";
  }
  else {
  return "Change Me";
  }
  // Only change code above this line
}

// Change these values to test
golfScore(5, 4);
Harry Fahringer III
@harryrf
Any idea what I'm still doing wrong here? https://codepen.io/harryrf3/pen/EXVWdv?editors=1010
My button changes from fahrenheit to celsius, but not back
Diego Mayer
@Chrono79
@ednor where is strokes there?
Ednor
@ednor
@ednor where is strokes there?
Euh !!!
tiger500
@tiger500
@kumquatfelafel no
kumquatfelafel
@kumquatfelafel
@tiger500 you don't see a variable you could use to store the temperature in ºF?
Ednor
@ednor
@Chrono79, so instead of using par as variable, it should be strokes, right ?
kumquatfelafel
@kumquatfelafel
@ednor both par and strokes are important.
Diego Mayer
@Chrono79
@ednor par and strokes are your function parameters, you have to use both (not in all cases)
strokes is needed in all your if conditions, compare it against the values of the table's first column
tiger500
@tiger500
@kumquatfelafel fahrenheit
kumquatfelafel
@kumquatfelafel
@tiger500 yep
@tiger500 how about for ºC?
Ednor
@ednor
@Chrono79, @kumquatfelafel, I am COMPLETELY lost
tiger500
@tiger500
@kumquatfelafel Celsius
Diego Mayer
@Chrono79
@ednor
if (strokes == 1) {
  return "Hole-in-one!"; // <- the string must be exactly what they wrote
Complete it with the other cases
Ednor
@ednor
ok @Chrono79 , let me continue with your logic
kumquatfelafel
@kumquatfelafel
@tiger500 close. Is it written exactly as Celsius in your code?
AnonimoProgrammatore
@AnonimoProgrammatore

sorry guys but the RegEx

/\W/g

it's supposed to comprend "_" underscore too, right?

Diego Mayer
@Chrono79
@AnonimoProgrammatore \w is all letters, all numbers and _
\W is not all that
tiger500
@tiger500
@kumquatfelafel Celsius time
Joseph
@revisualize
Hello.
Diego Mayer
@Chrono79
:wave:
Ednor
@ednor
@Chrono79 , what is the condition when strokes return Par
?
Joseph
@revisualize
@ednor strokes return par?
Diego Mayer
@Chrono79
@ednor strokes == par but that's the last one I'll give you, you're on your own from there
Try to see the logic of comparing strokes against the first column and returning the second, that's how you normally read a table
AnonimoProgrammatore
@AnonimoProgrammatore
@Chrono79 Thanks you, I tought that "_" was not in \w
CamperBot
@camperbot
anonimoprogrammatore sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4432 | @chrono79 |http://www.freecodecamp.com/chrono79
Ednor
@ednor
Okay @revisualize and @Chrono79
AnonimoProgrammatore
@AnonimoProgrammatore
well palyndrome function gone, may i post it here and ask you if it is ok or it could be better?
Claudio Restifo
@Marmiz
@ednor conveniently there's a table on the page that show you the values and the expected result. Example:
strokes is par + 1 return "Bogey"
You only need to "convert" it into code
kumquatfelafel
@kumquatfelafel

@ednor If you're still having trouble, let's take a step back on this problem for a moment.

Suppose par is 5. Let's not think of it as a variable at all... just 5.

if I hit ball in hole in 5, so strokes = 5, then I get "Par". What is the relation between strokes and 5 (par) here? Does strokes + 7 = 5? Or from another perspective, what is strokes - 5?
if I hit ball in hole in 6, so strokes = 5, then I get "Bogey". What is the relation between strokes and 5 (par) here? Does strokes + 7 = 5? Or from another perspective, what is strokes - 5?

Ednor
@ednor
now I understand why there are positive and negative values. Below is my new code, but I still have trouble with it

function golfScore(par, strokes) {
  // Only change code below this line

  if (strokes == 1) {
    return "Hole-in-one";
  } else if (strokes <= par - 2) {
    return "Eagle";
  } else if (strokes == par - 1) {
    return "Birdie";
  } else if (strokes == par) {
    return "Par";
  } else if (strokes == par + 1) {
    return "Bogey";
  } else if (strokes == par + 2) {
    return "Double Bogey";
  } else if (strokes >= par + 3) {
    return "Go Home!";
  }
  else {
  return "Change Me";
  }
  // Only change code above this line
}

// Change these values to test
golfScore(5, 4);
Diego Mayer
@Chrono79
@ednor The strings must be exact
Hole-in-one is missing a ! at the end
CallMeOrange
@EgnaroDev
I dont even understand Golf
kumquatfelafel
@kumquatfelafel
@MCTwoDigitZero Nobody does. :p