0
Make this code work.... I want user input
2 ответов
+ 3
hi, creating an instance of inbox requires 2 positional arguments:
c = inbox(1,'aaa')
use this to run the code
+ 1
First, cprint is not a valid keyword maybe you meant print
Also, the line users[c.number] = cprint(users[3]) cannot work since when this line is reached the first time users is an empty dict and thus a key error wil be raised
You could change users = {} by users = defaultdict(str) (coming from from collections import defaultdict) that will handle the case when the key is associated with no value
The following code cannot work
c = inbox # c will be the type inbox and not an instance of inbox
print(c.number)
you can replace it by: c = inbox.messagebox()