The Student Room Group

Anyone want to learn python?

I've decided to learn python, but I'm an absolute beginner. All I know is the basic syntax, pretty much. Is anyone else in a similar situation, and interested in a learning buddy?

We could keep each other motivated :biggrin:
yeh im up for it!!
Already did.
It's a great first language but now I hate it.
What do you mean by basic syntax? There's not that much to learn after the basics really, just task specific things.
Parseltongue > Python. :colonhash:
Original post by TattyBoJangles
Parseltongue > Python. :colonhash:


Kill.....
Reply 5
Original post by elephantinc
There's not that much to learn after the basics really


If you think this of any language then you haven't learnt it properly.
Reply 6
Original post by jackhughesie
yeh im up for it!!


Cool. :biggrin: I couldn't find anyone in the real world that wanted to. Lazies, the lot of them :tongue:
I keep meaning to, and then not getting round to it >< I even installed a bunch of programs on my computer aimed at teaching young children how to code! Perfect, as that's really the level I need complicated things pitched to me at :p:
Original post by Planto
If you think this of any language then you haven't learnt it properly.


I did say besides task specific things. Once you have the basics down, you tend to learn things as you need them.
Reply 9
I found an amazing "free or donate" ebook but have since lost it!

Also ITT: female programmers... something is not quite right here! :P
More than welcome to play my game :biggrin:




#Rock, Paper, Scissors game. Written by Luke Presland

import random

computer_score = 0
user_score = 0
draw_score = 0

print "Welcome to Rock, Paper, Scissor!"
print ""

def main():
global computer_score
global user_score
global draw_score




for i in range (1):
computer = random.randint(1, 3)
print "The computer has already chosen."
print ""
user = validated_input("Choose either 1 for Rock, 2 for Paper or 3 for Scissors: ")
print ""

print "The computer has chosen:", computer
print "You have chose:", user

if user == computer :
draw_score = draw_score + 1
print "Draw! Please play again."
loop()
elif user == 1 and computer == 2 :
user_score = user_score + 1
print "Paper beats Rock. You Win!"
loop()
elif user == 2 and computer ==1 :
computer_score = computer_score + 1
print "Paper beats Rock. Computer Wins. Try again!"
loop()
elif user == 2 and computer == 3 :
computer_score = computer_score + 1
print "Scissors beat Paper. Computer Wins. Try again!"
loop()
elif user == 3 and computer == 2 :
user_score= user_score + 1
print "Scissors beat Paper. You Win!"
loop()
elif user == 1 and computer ==3 :
user_score = user_score + 1
print "Rock beats Scissors. You Win!"
loop()
elif user == 3 and computer == 1 :
computer_score = computer_score + 1
print " Rock beats Scissors! Computer Wins. Try again!"
loop()

return computer_score
return user_score
return score_draw


def validated_input(prompt):
user = input(prompt)
while user > 3 or user <1 :
user = input("Choose either 1 for Rock, 2 for Paper or 3 for Scissors: ")
return user


def loop():
print ""
again = input("Do you want to play again? Enter any number to continue or 0 to quit and show results. ")
while again != 0 :
main()
again = input("Do you want to play again? Enter any number to continue or 0 to quit and show results.")
else :
global user_score
global computer_score
global draw_score
print""
print " \t \t \t The Results"
print "-----------------------------"
print "You: %s " %(user_score)
print "The Computer: %s " %(computer_score)
print "Draws: %s " %(draw_score)
print ""
if user_score > computer_score :
print "Well done! You have won!"
elif computer_score > user_score :
print "Sorry! The computer won this time. Try again next time!"
elif user_score == computer_score :
print "It was a draw this time! Try again next time!"


main()

Reply 11
Original post by unrealnumbers
More than welcome to play my game :biggrin:


would you mind explaining how to use return to me? It takes a value back to the 'main program', apparently, but when do you have to use it and when can you just 'name' a variable and use that?... Sorry if this is a bit confused :biggrin:



Original post by Javindo
I found an amazing "free or donate" ebook but have since lost it!

Also ITT: female programmers... something is not quite right here! :P


:smile: Are you studying compsci? I looked at the stats, there are so many men!
Reply 12
Original post by Melanie-v
would you mind explaining how to use return to me? It takes a value back to the 'main program', apparently, but when do you have to use it and when can you just 'name' a variable and use that?... Sorry if this is a bit confused :biggrin:

I do not know Python but from my programming experience, a "return" is what a function can quite literally "return/send back" when called so for example (pseudocode) (may need to scroll down):
function Test(){
[INDENT]string = "Hello world"
return string[/INDENT]
}

Output Test()


This would output "Hello world".

I hope that sort of makes sense! An example would be "if this function returns true, carry on" etc.




:smile: Are you studying compsci? I looked at the stats, there are so many men!

I hope to study it at uni and currently study "Computing" at A level. :smile:


Responses in bold :smile:
(edited 13 years ago)
Reply 13
Original post by Melanie-v
I've decided to learn python, but I'm an absolute beginner. All I know is the basic syntax, pretty much. Is anyone else in a similar situation, and interested in a learning buddy?

We could keep each other motivated :biggrin:


Hey, I have recently started teaching myself Python.
I would be greatly interested in learning with you and we can share guides and give each other small programming challenges :smile:

Send me a message if you're interested and everyone else in this thread to ^_^
Reply 14
this is a good site i recommend to start learning languages

http://www.thenewboston.com/?cat=40&pOpen=tutorial
Reply 15
I've done some python in my time, its a really fun language and I certainly wouldn't mind going over it again.

If you need any help on where to start/materials/resources/general advice/[insert problem here]
send me a PM. :biggrin:

Quick Reply

Latest

Trending

Trending