Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actual6677

Posted 05 October 2012 - 04:04 PM

If your completely new to programming then I highly recommend python. Its about as simple as programming gets (short of visual tools anyway) while being a very powerful language at the same time. The skills you learn in python will then apply to other languages. Someone has already posted a python 3 video tutorial. Each generation of python is ever so slightly different. 2 is still remarkably common, 3 is relatively new but all the best tutorials are for 3. 2 is slowly being phased out. If you find the tutorials that suit you best are for 2 then use 2 but otherwise you might aswell use 3, just make sure on the python website you download the correct version for your tutorial (I believe that would be either 2.7 for python 2 or 3.1 for python 3). One python tutorial thats meant to be pretty good can be found here: http://inventwithpython.com/chapters/ (python 3)

C# and java are often recommended too. These are also excellent choices although harder than python (I happen to know both python and C#, have not used java although I hear java and C# are very similar in syntax and difficulty).

For comparison here is the same program written in python 3 and in C# 4.

Python

[source lang="python"]import randomimport timedef displayIntro(): print('You are in a land full of dragons. In front of you,') print('you see two caves. In one cave, the dragon is friendly') print('and will share his treasure with you. The other dragon') print('is greedy and hungry, and will eat you on sight.') print()def chooseCave(): cave = '' while cave != '1' and cave != '2': print('Which cave will you go into? (1 or 2)') cave = input() return cavedef checkCave(chosenCave): print('You approach the cave...') time.sleep(2) print('It is dark and spooky...') time.sleep(2) print('A large dragon jumps out in front of you! He opens his jaws and...') print() time.sleep(2) friendlyCave = random.randint(1, 2) if chosenCave == str(friendlyCave): print('Gives you his treasure!') else: print('Gobbles you down in one bite!')playAgain = 'yes'while playAgain == 'yes' or playAgain == 'y': displayIntro() caveNumber = chooseCave() checkCave(caveNumber) print('Do you want to play again? (yes or no)') playAgain = input()[/source]

C#

[source lang="csharp"]using System;using System.Collections.Generic;using System.Text;namespace DragonRealm{ class Functions { } class Program { static void displayIntro() { Console.WriteLine("You are in a land full of dragons. In front of you,"); Console.WriteLine("you see two caves. In one cave, the dragon is friendly"); Console.WriteLine("and will share his treasure with you. The other dragon"); Console.WriteLine("is greedy and hungry, and will eat you on sight."); Console.WriteLine(); } static string chooseCave() { string cave = ""; while ((cave != "1") & (cave != "2")) { Console.WriteLine("Which cave will you go into? (1 or 2)"); cave = Console.ReadLine(); } return cave; } static void checkCave(string chosenCave) { Console.WriteLine("You approach the cave..."); Console.WriteLine(""); System.Threading.Thread.Sleep(800); Console.WriteLine("It is dark and spooky..."); Console.WriteLine(""); System.Threading.Thread.Sleep(800); Console.WriteLine("A large dragon jumps out infront of you! He opens his jaws and..."); Console.WriteLine(""); System.Threading.Thread.Sleep(1200); Random random = new Random(); string friendlyCave = random.Next(1, 3).ToString(); if (chosenCave == friendlyCave) { Console.WriteLine("Gives you his treasure!"); } else { Console.WriteLine("Gobbles you down in one bite!"); } } static void Main(string[] args) { string playAgain = "yes"; while (playAgain == "yes") { Console.Clear(); displayIntro(); string CaveNumber = chooseCave(); checkCave(CaveNumber); Console.WriteLine("Do you want to play again? (yes or no)"); playAgain = Console.ReadLine(); } } }}[/source]
You can see for yourself which of the 2 is simpler to follow. I do have to say, that program could be simplified for a beginner a little further (in which case they begin to look a little more similar). The original python code I found here: http://inventwithpyt...m/chapter6.html I then ported it to C# myself a few days ago in order to practice my C# skills.

I do not recommend learning an un-managed language first. C++ is an excellent example of an un-managed language. Later on then C++ is probably the best language but its also one of the hardest to work with and immense for a newcomer. Not impossible for a newbie but no offense you haven't googled for a programming tutorial yourself yet so I doubt you have the patience to learn C++.


EDIT:
Jesus christ the forum's code tag does not work well, but then it does say experimental I guess.

#36677

Posted 05 October 2012 - 04:02 PM

If your completely new to programming then I highly recommend python. Its about as simple as programming gets (short of visual tools anyway) while being a very powerful language at the same time. The skills you learn in python will then apply to other languages. Someone has already posted a python 3 video tutorial. Each generation of python is ever so slightly different. 2 is still remarkably common, 3 is relatively new but all the best tutorials are for 3. 2 is slowly being phased out. If you find the tutorials that suit you best are for 2 then use 2 but otherwise you might aswell use 3, just make sure on the python website you download the correct version for your tutorial (I believe that would be either 2.7 for python 2 or 3.1 for python 3).

C# and java are often recommended too. These are also excellent choices although harder than python (I happen to know both python and C#, have not used java although I hear java and C# are very similar in syntax and difficulty).

For comparison here is the same program written in python 3 and in C# 4.

Python

[source lang="python"]import randomimport timedef displayIntro(): print('You are in a land full of dragons. In front of you,') print('you see two caves. In one cave, the dragon is friendly') print('and will share his treasure with you. The other dragon') print('is greedy and hungry, and will eat you on sight.') print()def chooseCave(): cave = '' while cave != '1' and cave != '2': print('Which cave will you go into? (1 or 2)') cave = input() return cavedef checkCave(chosenCave): print('You approach the cave...') time.sleep(2) print('It is dark and spooky...') time.sleep(2) print('A large dragon jumps out in front of you! He opens his jaws and...') print() time.sleep(2) friendlyCave = random.randint(1, 2) if chosenCave == str(friendlyCave): print('Gives you his treasure!') else: print('Gobbles you down in one bite!')playAgain = 'yes'while playAgain == 'yes' or playAgain == 'y': displayIntro() caveNumber = chooseCave() checkCave(caveNumber) print('Do you want to play again? (yes or no)') playAgain = input()[/source]

C#

[source lang="csharp"]using System;using System.Collections.Generic;using System.Text;namespace DragonRealm{ class Functions { } class Program { static void displayIntro() { Console.WriteLine("You are in a land full of dragons. In front of you,"); Console.WriteLine("you see two caves. In one cave, the dragon is friendly"); Console.WriteLine("and will share his treasure with you. The other dragon"); Console.WriteLine("is greedy and hungry, and will eat you on sight."); Console.WriteLine(); } static string chooseCave() { string cave = ""; while ((cave != "1") & (cave != "2")) { Console.WriteLine("Which cave will you go into? (1 or 2)"); cave = Console.ReadLine(); } return cave; } static void checkCave(string chosenCave) { Console.WriteLine("You approach the cave..."); Console.WriteLine(""); System.Threading.Thread.Sleep(800); Console.WriteLine("It is dark and spooky..."); Console.WriteLine(""); System.Threading.Thread.Sleep(800); Console.WriteLine("A large dragon jumps out infront of you! He opens his jaws and..."); Console.WriteLine(""); System.Threading.Thread.Sleep(1200); Random random = new Random(); string friendlyCave = random.Next(1, 3).ToString(); if (chosenCave == friendlyCave) { Console.WriteLine("Gives you his treasure!"); } else { Console.WriteLine("Gobbles you down in one bite!"); } } static void Main(string[] args) { string playAgain = "yes"; while (playAgain == "yes") { Console.Clear(); displayIntro(); string CaveNumber = chooseCave(); checkCave(CaveNumber); Console.WriteLine("Do you want to play again? (yes or no)"); playAgain = Console.ReadLine(); } } }}[/source]
You can see for yourself which of the 2 is simpler to follow. I do have to say, that program could be simplified for a beginner a little further (in which case they begin to look a little more similar). The original python code I found here: http://inventwithpyt...m/chapter6.html I then ported it to C# myself a few days ago in order to practice my C# skills.

I do not recommend learning an un-managed language first. C++ is an excellent example of an un-managed language. Later on then C++ is probably the best language but its also one of the hardest to work with and immense for a newcomer. Not impossible for a newbie but no offense you haven't googled for a programming tutorial yourself yet so I doubt you have the patience to learn C++.


EDIT:
Jesus christ the forum's code tag does not work well, but then it does say experimental I guess.

#26677

Posted 05 October 2012 - 04:01 PM

If your completely new to programming then I highly recommend python. Its about as simple as programming gets (short of visual tools anyway) while being a very powerful language at the same time. The skills you learn in python will then apply to other languages. Someone has already posted a python 3 video tutorial. Each generation of python is ever so slightly different. 2 is still remarkably common, 3 is relatively new but all the best tutorials are for 3. 2 is slowly being phased out. If you find the tutorials that suit you best are for 2 then use 2 but otherwise you might aswell use 3, just make sure on the python website you download the correct version for your tutorial (I believe that would be either 2.7 for python 2 or 3.1 for python 3).

C# and java are often recommended too. These are also excellent choices although harder than python (I happen to know both python and C#, have not used java although I hear java and C# are very similar in syntax and difficulty).

For comparison here is the same program written in python 3 and in C# 4.

Python

[source lang="python"]import randomimport timedef displayIntro(): print('You are in a land full of dragons. In front of you,') print('you see two caves. In one cave, the dragon is friendly') print('and will share his treasure with you. The other dragon') print('is greedy and hungry, and will eat you on sight.') print()def chooseCave(): cave = '' while cave != '1' and cave != '2': print('Which cave will you go into? (1 or 2)') cave = input() return cavedef checkCave(chosenCave): print('You approach the cave...') time.sleep(2) print('It is dark and spooky...') time.sleep(2) print('A large dragon jumps out in front of you! He opens his jaws and...') print() time.sleep(2) friendlyCave = random.randint(1, 2) if chosenCave == str(friendlyCave): print('Gives you his treasure!') else: print('Gobbles you down in one bite!')playAgain = 'yes'while playAgain == 'yes' or playAgain == 'y': displayIntro() caveNumber = chooseCave() checkCave(caveNumber) print('Do you want to play again? (yes or no)') playAgain = input()[/source]

C#

[source lang="csharp"]using System;using System.Collections.Generic;using System.Text;namespace DragonRealm{ class Functions { } class Program { static void displayIntro() { Console.WriteLine("You are in a land full of dragons. In front of you,"); Console.WriteLine("you see two caves. In one cave, the dragon is friendly"); Console.WriteLine("and will share his treasure with you. The other dragon"); Console.WriteLine("is greedy and hungry, and will eat you on sight."); Console.WriteLine(); } static string chooseCave() { string cave = ""; while ((cave != "1") & (cave != "2")) { Console.WriteLine("Which cave will you go into? (1 or 2)"); cave = Console.ReadLine(); } return cave; } static void checkCave(string chosenCave) { Console.WriteLine("You approach the cave..."); Console.WriteLine(""); System.Threading.Thread.Sleep(800); Console.WriteLine("It is dark and spooky..."); Console.WriteLine(""); System.Threading.Thread.Sleep(800); Console.WriteLine("A large dragon jumps out infront of you! He opens his jaws and..."); Console.WriteLine(""); System.Threading.Thread.Sleep(1200); Random random = new Random(); string friendlyCave = random.Next(1, 3).ToString(); if (chosenCave == friendlyCave) { Console.WriteLine("Gives you his treasure!"); } else { Console.WriteLine("Gobbles you down in one bite!"); } } static void Main(string[] args) { string playAgain = "yes"; while (playAgain == "yes") { Console.Clear(); displayIntro(); string CaveNumber = chooseCave(); checkCave(CaveNumber); Console.WriteLine("Do you want to play again? (yes or no)"); playAgain = Console.ReadLine(); } } }}[/source]
You can see for yourself which of the 2 is simpler to follow. I do have to say, that program could be simplified for a beginner a little further (in which case they begin to look a little more similar). The original python code I found here: http://inventwithpyt...m/chapter6.html I then ported it to C# myself a few days ago in order to practice my C# skills.

I do not recommend learning an un-managed language first. C++ is an excellent example of an un-managed language. Later on then C++ is probably the best language but its also one of the hardest to work with and immense for a newcomer. Not impossible for a newbie but no offense you haven't googled for a programming tutorial yourself yet so I doubt you have the patience to learn C++.

#16677

Posted 05 October 2012 - 04:00 PM

If your completely new to programming then I highly recommend python. Its about as simple as programming gets (short of visual tools anyway) while being a very powerful language at the same time. The skills you learn in python will then apply to other languages. Someone has already posted a python 3 video tutorial. Each generation of python is ever so slightly different. 2 is still remarkably common, 3 is relatively new but all the best tutorials are for 3. 2 is slowly being phased out. If you find the tutorials that suit you best are for 2 then use 2 but otherwise you might aswell use 3, just make sure on the python website you download the correct version for your tutorial (I believe that would be either 2.7 for python 2 or 3.1 for python 3).

C# and java are often recommended too. These are also excellent choices although harder than python (I happen to know both python and C#, have not used java although I hear java and C# are very similar in syntax and difficulty).

For comparison here is the same program written in python 3 and in C# 4.

[source lang="python"]import randomimport timedef displayIntro(): print('You are in a land full of dragons. In front of you,') print('you see two caves. In one cave, the dragon is friendly') print('and will share his treasure with you. The other dragon') print('is greedy and hungry, and will eat you on sight.') print()def chooseCave(): cave = '' while cave != '1' and cave != '2': print('Which cave will you go into? (1 or 2)') cave = input() return cavedef checkCave(chosenCave): print('You approach the cave...') time.sleep(2) print('It is dark and spooky...') time.sleep(2) print('A large dragon jumps out in front of you! He opens his jaws and...') print() time.sleep(2) friendlyCave = random.randint(1, 2) if chosenCave == str(friendlyCave): print('Gives you his treasure!') else: print('Gobbles you down in one bite!')playAgain = 'yes'while playAgain == 'yes' or playAgain == 'y': displayIntro() caveNumber = chooseCave() checkCave(caveNumber) print('Do you want to play again? (yes or no)') playAgain = input()[/source]
[source lang="csharp"]using System;using System.Collections.Generic;using System.Text;namespace DragonRealm{ class Functions { } class Program { static void displayIntro() { Console.WriteLine("You are in a land full of dragons. In front of you,"); Console.WriteLine("you see two caves. In one cave, the dragon is friendly"); Console.WriteLine("and will share his treasure with you. The other dragon"); Console.WriteLine("is greedy and hungry, and will eat you on sight."); Console.WriteLine(); } static string chooseCave() { string cave = ""; while ((cave != "1") & (cave != "2")) { Console.WriteLine("Which cave will you go into? (1 or 2)"); cave = Console.ReadLine(); } return cave; } static void checkCave(string chosenCave) { Console.WriteLine("You approach the cave..."); Console.WriteLine(""); System.Threading.Thread.Sleep(800); Console.WriteLine("It is dark and spooky..."); Console.WriteLine(""); System.Threading.Thread.Sleep(800); Console.WriteLine("A large dragon jumps out infront of you! He opens his jaws and..."); Console.WriteLine(""); System.Threading.Thread.Sleep(1200); Random random = new Random(); string friendlyCave = random.Next(1, 3).ToString(); if (chosenCave == friendlyCave) { Console.WriteLine("Gives you his treasure!"); } else { Console.WriteLine("Gobbles you down in one bite!"); } } static void Main(string[] args) { string playAgain = "yes"; while (playAgain == "yes") { Console.Clear(); displayIntro(); string CaveNumber = chooseCave(); checkCave(CaveNumber); Console.WriteLine("Do you want to play again? (yes or no)"); playAgain = Console.ReadLine(); } } }}[/source]
You can see for yourself which of the 2 is simpler to follow. I do have to say, that program could be simplified for a beginner a little further (in which case they begin to look a little more similar). The original python code I found here: http://inventwithpython.com/chapter6.html I then ported it to C# myself a few days ago in order to practice my C# skills.

I do not recommend learning an un-managed language first. C++ is an excellent example of an un-managed language. Later on then C++ is probably the best language but its also one of the hardest to work with and immense for a newcomer. Not impossible for a newbie but no offense you haven't googled for a programming tutorial yourself yet so I doubt you have the patience to learn C++.

PARTNERS