Answer to Question #268024 in Python for Ae dion

Question #268024

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.


1
Expert's answer
2021-11-19T10:02:26-0500
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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS