class User :
def __int__(self, user_id, username):
self.id = user_id
self.username = username
user_1 = User("001", "allobang")
print(user_1.username)
user_2 = User("002", "Jack")
print(user_2.username)
ACTIVITIES:
1. Finish this code by adding a password attribute.
2. Assign passwords on user_1 and user_2 of your choice.
3. Create 3rd user object.
a. The value of the id should be your student ID number.
b. The value of username should be your first name.
c. Assign the value of the password attribute of your choice.
4. Print the username of 3rd user object.
class User :
def __init__(self, user_id, username):
self.id = user_id
self.username = username
user_1 = User("001", "allobang")
print(user_1.username)
user_2 = User("002", "Jack")
print(user_2.username)
user_1.password = "12345"
user_2.password = "68790"
user_3 = User("Rajiv","Rajiv_tomar")
user_3.password = "19BCS2467"
print(user_3.username)
Comments
Leave a comment