Struggling with program

maiden129 sengokubasarafever at gmail.com
Sun Feb 17 21:29:35 EST 2013


I'm trying to do this assignment and it not working, I don't understand why...

This is what I have to do:

Write the definition of a class  Player containing: 
An instance variable  name of type  String , initialized to the empty String.
An instance variable  score of type  int , initialized to zero.
A method called  set_name that has one parameter, whose value it assigns to the instance variable  name .
A method called  set_score that has one parameter, whose value it assigns to the instance variable  score .
A method called  get_name that has no parameters and that returns the value of the instance variable  name .
A method called  get_score that has no parameters and that returns the value of the instance variable  score .
 No constructor need be defined. 

Here is my code:

class Player:

	
	name = ''
	
	def __init__(self,score = 0)
	
	def set_name (self):
		self.name

	def set_score (self):
		self.score

	def get_name
		return name
	
	def  get_score
		return score

can someone please help me?



More information about the Python-list mailing list