Hej,
Jag håller på med labben och gjorde just 1.1 men jag är osäker på om jag löste det på rätt sätt. Kan ngn snäll själ kika och se ifall jag gjort rätt och om inte, tipsa om vad jag gjorde fel

)))
- Kod: Markera allt
# """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
# Exercise 1.1 (2 points)
#
# Create a new class named **Person**. Give the class the instance
# attributes "name" and "ssn". Make "ssn" a private attribute. The values for
# the attributes should be sent to the constructor as arguments.
# Create a *get* method for both "name" and "ssn". Only Create a *set* method
# for "name".
#
# In the code below create a new variable called **per** and set it to a new
# instance of Person. Give it the name `FitzChivalry` and ssn `350967-5218`.
#
#
# Answer with per\'s get method for ssn.
#
# Write your code below and put the answer into the variable ANSWER.
#
class Person():
def __init__(self, name, ssn):
self.name = name
self._ssn = ssn
def get_name(self):
return self.name
def get_ssn(self):
return self._ssn
def set_ssn(self, ssn):
self._ssn = ssn
per = Person("FitzChivalry", "350967-5218")
Anledningen till att jag blir osäker är att jag inte förstår vad set_ssn gör? Det funkar ju även om jag raderar den.