I am missing something?


#1

There doesn’t seem to be any getting started instructions in the python course other than
"Set the variable my_variable equal to the value 10.

Click the Run button to run your code."

It doesn’t give any kind of syntax instructions.

First tried

print my_variable = 10

Afterwords, I get this hint:

“Make sure to put my_variable on the left side of the =, and 10 on the right.”

which is what I thought I just did.

Then I see the code above and it looks like it wants me to put it there so I try.

set my_variable = 10

It doesn’t like that.

nor does it like

my_variable = 10

So where can I find some instructions on syntax ?

Thanks


#2

We must first complete the assignment before printing (if printing is not asked for, the don’t print).

>>> print (my_variable = 10)
Traceback (most recent call last):
  File "<pyshell#32>", line 1, in <module>
    print (my_variable = 10)
TypeError: 'my_variable' is an invalid keyword argument for this function
>>> 
my_variable = 10
print my_variable

docs.python.org


#3

I kinda figured that “my_variable = 10” was it but it did not work. It was indented 1 character to the right and that was throwing everything off.

Thank you for the link. I am back on track now.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.