Error or I'm I not learning the basics


#1

So thanks for this it seemed to be a great way to learn something new so I tried it.
I’ve only just started and either I’m not learning or there is an error.


![Screenshot_20180423-064802|281x500]

Should it not have been y for the answer? This is the second in a row I got wrong and they were both the same type of questions.
Can any one explain why my answer is wrong. I must be missing something.
Thanks


#2

Hi @Frankbonatelli,

Unfortunately, this is not a bug, but it’s definitely a bit of a tricky concept when first starting out, so I’ll do my best to try and clear things up. :slightly_smiling_face:

Here’s an explanation from a different post:

But if you’d like me to go more in-depth about variables, feel free to reply! :smile:


#3

That seems off to me.
I’ve read this a dozen times, maybe I am not cut out for programming if this stumps me.
It says in the image attached
QUOTE" When print (x) runs it looks inside the variable called x and prints out the value its holding. In this case, the variable x is holding the value 5 (not from what i see it is holding y) so that is what gets printed out."

var y = 5;
var x = y;
if print(x) is called is this not asking to know what is in var x? why the heck would it print 5 if it is holding y?


#4

Once you get past the learning curve, it’ll come naturally. :slight_smile: It’s like learning a new language.
x = 5; because y is given the value of 5 and then x is given the value of y (5). One way to look at this is:
x = y = 5
Both x and y are variables that store certain data (numbers, strings, etc.), but if a variable(x) tries to store another variable(y), then the variable(x) copies the value(5) of the other variable (y).

This allows you to change the value in y while keeping the original value in x in case you ever want to go back to it. Such as:

var y = 5;
var x = y;

y = y + 2;

print(y); //y = 7
print(x); //x = 5

Hope this did a better job, but feel free to reply if otherwise! :smile:


#5

Because this is similar to how the answer in the prior quiz LOOKED and you’re new to this, I think that’s why it’s confusing.

(Image of previous quiz)

The variables listed here are STRINGS (because they are in quotation marks) and print is asking for ALPHABET not in quotation marks.

In your quiz, print is asking for for X whose value is the variable Y — because x’s variable is NOT A STRING.

So you need to watch for those quotation marks and ask: is it asking for the string or for a variable?


#6

I read ALMOST all the answers — you nailed it and I wasted everyone’s time :joy:


#7

This sounds like a case where a drawing or even a video of the traditional post office box analogy (one labeled x, and another labelled y, with pieces of paper showing a 5 – except you can’t remove the paper from the box, just copy it) might be helpful.