Public Group

# Learning python

This topic is 4902 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I decided to go with Python for my first language. I have been workin with it for about half an hour now, and its really fun! 1 minute into it I learned that typing in:
import sys; sys.exit()
will exit the program. I could just click the X, but thats cool too. ;) I kept reading, and I saw an example of an "if" statement, and tried to make one I made up.
the_world_got_blown_up = 1
if the_world_got_blown_up:
print "We are screwed."
And after pressing enter twice, it said we are screwed! Heh this is great. :) I then learned for the if statement all I had to put was:
if 1:
I am learning slower at this point. It is talking about stuff like Unix, BSD, UTF, BOM, and stuff. Should I do something before trying to learn more so I can understand this? Or is this kind of stuff useless information that I should just skip?

##### Share on other sites
Unix and BSD are OSes (and your post makes it sound like you don't use them, so you can probably skip that). UTF is a character encoding. I don't know what BOM is. Maybe you meant DOM? Anyway, those are all things that you shouldn't need to get into for a while.

##### Share on other sites
Thanks. I also learned it was a calculator. It handled an incredibly complex simplifying problem in 1 second. (I just typed in about 6 lines full of numbers, multiplication, and division signs.)

*sigh*

Man I sound like a noob. Well, I am!

##### Share on other sites
Quote:
 Original post by RoboguyUTF is a character encoding. I don't know what BOM is. Maybe you meant DOM?

A BOM is a Byte Order Mark. UTF-* text files can have them at the beginning to indicate what endianness the file has (and, of course, the presence of a BOM also tells editors etc they are indeed dealing with an UTF encoded file).

##### Share on other sites
BOM in this context probably means byte order marker for Unicode files. You should learn that stuff probably eventually, but if you just want to write a game as soon as possible you can probably skip those topics for now.

##### Share on other sites
Ok, I am trying this variable thing now. (I guess you could call this a game - a very simple one.)

I have assigned the variables to numbers.

The variables are my 'characters', and the numbers are their body weight.

At the end, based on my logic (I never actually saw this was possible), I should be able to see how much they all weigh together on a scale.

idiot = 103unusually_fat_man = 609Me = 135Car = 2500

Those are my variables and their assigned numbers.

Now I have the next little piece of code:
all_of_us_on_a_scale = idiot+unusually_fat_man+Me+Car

Now when I run this through, I get the error:
Traceback (most recent call last):  File "<stdin>", line 1, in ?NameError: name 'me' is not defined

But it is defined! I defined it as Me = 135! Why does it pick on me?!

Pun intended.

##### Share on other sites
Haha, it's refreshing to see this kind of enthusiasm!

Have you seen this tutorial yet: http://www.freenetpages.co.uk/hp/alan.gauld/ ?

It's a great ground-up introduction to programming, with a strong emphasis on Python; seems like it could be useful.

Keep up the good attitude, and I wish you the best of luck!

Edit: as for your problem, Python is case sensitive, meaning 'Me' is different from 'me'; make sure that you've been consistant in your capitalisation, because it looks like that could be the problem (interpreter output has lowercase 'm' in 'Me').

##### Share on other sites
Look at the error, it is telling you that me is undefined. me and Me aren't the same thing. A good many programming language are case-sensitive. Python is one of them.

##### Share on other sites
I already had a look at that. I have them both as "Me". What else could it be?

Edit: I assigned the same thing to
me
, and put
me
as
us_on_a_scale
, and it worked. Are caps not allowed?

##### Share on other sites
Caps are allowed, but, as has been said before, everything is case sensitive so you'll need to be careful.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634136
• Total Posts
3015757
×