Recommended Posts

brian_m99uk    122
Well ive spent a few days looking at Python and im sorry if this is a simpler language then I think i may have lots of problems ahead. I have managed to get the hello world program workign though I dont know how. Anyway long story short decided to go for C++ though. This http://www.gamedev.net/community/forums/forum.asp?forum_id=76 and my book should make it a nice easy way in. If im still having problems I may see if there is a nice course nearby. Laters. Brian.

Share on other sites
C++ is a LOT harder of a language than Python. If you got confused with Python than what makes you think that C++ is a better choice? O_o.

The key to learning a programming language is to make lots of programs with it. You will get confused, you will make mistakes, but the key is to not rush and to work through it.

So here is my advice:

A) Stick with Python for now.

B) Keep working with it, reading tutorials, and trying to make your own programs.

C) Ask questions when you get stuck.

Good luck.

Share on other sites
brian_m99uk    122
OK i appreciate your point and i was expecting it.

However ill try to explain this somewhat.

Firstly I can at least understand the C++ program hello world i understand what the various parts of it do.

However with Python i cant even figure out how to get that simple program done.

In the tutorial i am doing "A Byte of Python" i can understand that its an interpreted program therefore it doesnt get compiled and that at the >>> promt i can enter a command just like in old spectum basic. However after that i get confused.

I typed the program as suggested and it didnt work, i then guessed that i needed to do it in a new shell of IDEL so i didnt have all the copyright info and version details.

so i have this program called helloworld.py saved in my c:\python25\ directory. If i run it in the shell presing ctrl-f5 it runs but if i try to run it from the command line it doesnt.

Ok then my next issue is that a lot of the online books and documents that i have seen refer a lot to Linux and Unix shells which i have no knowledge about save that it exsits.

Well thats my spleen vented. Can you offer any advice?

Thanks
Brian.

Share on other sites
programering    105
And one very important thing; start out small.

Share on other sites
HappyCoder    5052
I actually had a similar experience. I have been programming C++ for about 5 years now. I recently took a look at python and it confused me a bit. I understand it better now but the difference between tuples, lists, and dictionaries still is a little fuzzy for me.

My advice to brian, be sure to take the time to learn whatever language you decide one and don't expect it to come quickly. It may come quickly but just don't expect it to.

Once advantage to python is it handles a lot of the lower level details that you need to worry about with C++. It is also really easy to work with lists in Python, although given the right classes c++ can also have that same ease. Python also has a lot of premade libraries that are common for all platforms.

C++ obviously has the power and control advantages. It will also be more difficult to learn in more detail. I think that C++ can be a beginner programming language as long as whoever is learned sticks with it and give up because of frustration.

Either language will take time to learn but I do think that python is the better beginner language.

Best of luck to you.

Share on other sites
Quote:
 the difference between tuples, lists, and dictionaries still is a little fuzzy for me

An n-tuple is a tuple containing an ordered list of n objects. A tuple contains a fixed number of objects. A 2-tuple (or pair) of type (Integer, Integer) stores exactly two components of type Integer – an example is (2, 2) – it might be used as a representation of a point. A 3-tuple (triple) of type (String, String, Integer) comprises exactly two components of type String, followed by exactly one component of type Integer – an example might be ("John", "Smith", 123) – a first name, last name and some sort of ID, perhaps.

A list is an ordered collection of objects, all of which are of the same type (remembering that you can usually represent objects of different derived types as their common base type). [1, 3, 2, 4] is an example of a list of length 4 with elements of type Integer; it is ordered (3 is after 1, 2 is after 3, 4 is after 2) but unsorted (although it could be sorted, if desired).

A dictionary provides a 1:1 mapping (a bijection) from a set of keys to a set of values (in much the same way as its real-world namesake does – the word in a real-world dictionary is the key, and the definition the value). The keys and values need not be of the same type (so you might have a dictionary mapping keys of type Integer to values of type (String, String, Integer)). There are a number of different possible implementations, which vary in efficiency. For example (I don't know Python), someDictionary["John Smith"] = 123 might set the value associated with the key "John Smith" to 123. You could then retrieve that as someDictionary["John Smith"].

Share on other sites
biggjoee5790    229
it seems that you having problems with the IDE and not the language itself. It doesnt make sense to me that you would understand a hello world program perfectly in C++ and not in Python. I dont know much C++ but i do know that the hello world program is a bit more complicated than Pythons simple...

print "Hello World!"

So ya i think you just need to figure out how to use your interpreter better.. are you using IDLE?

Share on other sites
superpig    1825
Quote:
 Original post by TheUnbelieverA dictionary provides a 1:1 mapping (a bijection) from a set of keys to a set of values (in much the same way as its real-world namesake does – the word in a real-world dictionary is the key, and the definition the value).

Er, really? Every key maps to a unique value, and it's therefore possible to get from the value back to the key?

Share on other sites
brian_m99uk    122
ok so i have stuck at it and found a better book. :P

Im now working from Beggining Python by Magnus Hetland and it seems to be a lot clearer than the Byte of Python was.

Right then back to it.

Share on other sites
Darragh    308
Quote:
 Original post by shadowisadogC++ is a LOT harder of a language than Python. If you got confused with Python than what makes you think that C++ is a better choice? O_o.

I can see where he's coming from actually. I've been programming in C/C++ for about 4 years now and recently I started learning Ruby, which in many ways is quite similar to Python or Perl. One of the main difficulites I found during my time working with Ruby was that sometimes I could write a statement and not know exactly what it was doing; the language is so high level that it's sometimes difficult to determine exactly what the effect of each statement is. It's always a decidedly dodgy business when you start writing code and you're not even sure what it is doing IMHO!

Not that I'm suggesting he should switch immediately to C++ however! But there can be such thing as going too far high-level also; sometimes it pays to get down to the nitty gritty and understand the fine details of how stuff gets done. If you do want to go down the C++ route however I'd suggest you stick to pure C for the time being and forget about all the object oriented features of C++ until you are comfortable with the language. There's also the possibility of using C#- something which I'd highly recommend. C# is one of the cleanest languages I've ever come across and if you get good with it you could jump into XNA afterwords to. Worth considering if you want to change language...

Share on other sites
Quote:
Original post by Darragh
Quote:
 Original post by shadowisadogC++ is a LOT harder of a language than Python. If you got confused with Python than what makes you think that C++ is a better choice? O_o.

I can see where he's coming from actually. I've been programming in C/C++ for about 4 years now and recently I started learning Ruby, which in many ways is quite similar to Python or Perl. One of the main difficulites I found during my time working with Ruby was that sometimes I could write a statement and not know exactly what it was doing; the language is so high level that it's sometimes difficult to determine exactly what the effect of each statement is. It's always a decidedly dodgy business when you start writing code and you're not even sure what it is doing IMHO!

Very true. I have programmed in C++ for over six years but I have recently started to move to higher level languages because work demanded it. My main point is that C++ is a much more confusing language for a novice to start with. When I started programming I actually used QBasic and some other now extinct languages to learn the basics and only later did I decide to make the leap to C++. C++ has a lot of undefined behaviors and if you don't know how to work with pointers you can cause a lot of memory leaks and crashes very quickly.

[Edited by - shadowisadog on March 3, 2008 12:39:45 PM]

Share on other sites
Darragh    308
Quote:
 Original post by shadowisadogC++ has a lot of undefined behaviors and if you don't know how to work with pointers you can cause a lot of memory leaks and crashes very quickly.

Indeed. Like I'm sure there are lot's of people out there with a good working knowledge of the language who might even be confused by statements such as these:

// ? void _cdecl blah();void _stdcall blah2();// ? :)void blah2( void * p ){   ((void(*)())(p))();}

Things like that you just don't see the books on C++ and it's rife in some of the code you will come across on the net.

Share on other sites
Quote:
Original post by superpig
Quote:
 Original post by TheUnbelieverA dictionary provides a 1:1 mapping (a bijection) from a set of keys to a set of values (in much the same way as its real-world namesake does – the word in a real-world dictionary is the key, and the definition the value).

Er, really? Every key maps to a unique value, and it's therefore possible to get from the value back to the key?

Oops. No. It'd be a surjection, not a bijection (right?).

My apologies.

Share on other sites
Zahlman    1682
Quote:
Original post by superpig
Quote:
 Original post by TheUnbelieverA dictionary provides a 1:1 mapping (a bijection) from a set of keys to a set of values (in much the same way as its real-world namesake does – the word in a real-world dictionary is the key, and the definition the value).

Er, really? Every key maps to a unique value, and it's therefore possible to get from the value back to the key?

For reference. The mapping is a surjection: you can repeat values, and the mapping is therefore not reversible (unless you avoid repeating values manually, and reverse the mapping yourself).

Share on other sites
brian_m99uk    122
Woo,

Well im getting into this python thing ive done hello worlds, and getting me to input my name. It was deffinatly the book i was looking at.

Well now ill not be revisiting this thread as it seems to have spiraled out into things i dont know about.

Well here i go into the breach.

o/

Brian.

Share on other sites
superpig    1825
Quote:
Original post by Zahlman
Quote:
Original post by superpig
Quote:
 Original post by TheUnbelieverA dictionary provides a 1:1 mapping (a bijection) from a set of keys to a set of values (in much the same way as its real-world namesake does – the word in a real-world dictionary is the key, and the definition the value).

Er, really? Every key maps to a unique value, and it's therefore possible to get from the value back to the key?

For reference. The mapping is a surjection: you can repeat values, and the mapping is therefore not reversible (unless you avoid repeating values manually, and reverse the mapping yourself).

Well, no; it's neither injective (one-to-one) nor surjective (covering every possible target value). It's just a mapping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account