Jump to content

Variables not functioning as expected


Recommended Posts

I took a Python coding course in college. Basic level, it taught me how to code short, basic programs.
This was six months ago.
I recently tried to pick coding back up, and decided my first project; a dice game I had an idea for a while back, as a computer program.
Problem: I've apparently forgotten how to do just about everything, because I can't even figure out why Pyzo (my program of choice for writing in Python) is throwing an error. All I want to do on the line in question is set a variable to 1. That's all. I've tried changing the variable name, tried putting it in all forms of quotation marks that I could think of. I even tried double equal signs.
But:
"dice1 = 1"
is absolutely against the law, and I can not understand why. I've tried google search. I've tried Youtube for basic learning videos on Python. I tried everywhere I could think of on w3schools. I even tried StackOverflow, but they're very professional, like actual software developers, and that... intimidates me. I'm simply trying to pick this back up as a hobby.

Link to post
Share on other sites

I just tested this in the python compiler, below is valid python code.

dice1 = 123
print(dice1)

Outputs: 123

 

Is there a particular error which is showing up? Any other code you could provide?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...