Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. # nasza definicja w której musimy napisać kod
  2. def update(table, id_):
  3.     """
  4.    Updates specified record in the table. Ask users for new data.
  5.  
  6.    Args:
  7.        table (list): list in which record should be updated
  8.        id_ (str): id of a record to update
  9.  
  10.    Returns:
  11.        list: table with updated record
  12.    """
  13.     user_input = []
  14.     record_to_update = []
  15.     index_of_record_to_update = 0
  16.     for index, record in enumerate(table):
  17.         if record[0] == id_:
  18.             record_to_update = record
  19.             index_of_record_to_update = index
  20.  
  21.  
  22.     #tutaj musicie zrobic zapytanie do uzytkownika co chce zmienic ze np
  23.     # change year enter:0
  24.     # change costam enter:1
  25.     # nie wiem jaka jest funckja w pythonie musicie sprawdzic
  26.     # nastepnie kolejne pytanie na co chce zmienic
  27.     # i teraz znacie record i wiecie co zmienic to
  28.     # np.
  29.     new_year = "1999"
  30.     record_to_update[5] = new_year
  31.     table[index_of_record_to_update] = record_to_update
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement