Conversation
| @@ -0,0 +1,13 @@ | |||
|
|
|||
| class Person: | |||
There was a problem hiding this comment.
something went wrong here :D
| elif entrance.lower() == 'no': | ||
| print('Thank you, see you next time...') | ||
| else: | ||
| input('Your request is not recognised') |
There was a problem hiding this comment.
you need to give an option or command for user to re enter yes or finish
| "Tinta": 8, | ||
| "Erol": 6, | ||
| "Orhan": 5 | ||
| } |
|
|
||
|
|
||
| def add_student(name,grade): | ||
| if name in students: |
There was a problem hiding this comment.
you may need to add some string manipulation, capital case or lower case
| print('We already have a student with this name') | ||
| return | ||
|
|
||
| if grade not in [1-10]: |
There was a problem hiding this comment.
this is tricky, remember all input from user get registered as "String", so you need to cast it here
There was a problem hiding this comment.
Also [] is list in python (similar to Array ) so you have here one item with value -9.
If you want to check range
you can write
grade not in range(1,11)
| try: | ||
| students[name] = int(grade) | ||
| print(f"{name} is added with grade {students.get(name)}") | ||
| except ValueError: |
There was a problem hiding this comment.
usually it good to add a general exception JIC
| print('Please type a number as a level') | ||
|
|
||
| def update (name, grade): | ||
|
|
There was a problem hiding this comment.
extra line is not a good idea in python :) things can get off records quickly here with no ()
|
|
||
| def update (name, grade): | ||
|
|
||
| if grade not in [1 - 10]: |
| 'finish': finish | ||
| } | ||
|
|
||
| while order: |
There was a problem hiding this comment.
Impressive work on while one!
No description provided.