Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.35 KB | None | 0 0
  1. tree_number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  2. tree_apples = [[21, 48, 16, 24, 18, 38, 30, 44, 37, 26],
  3.               [48, 41, 49, 48, 30, 30, 17, 22, 33, 42],
  4.               [36, 49, 42, 36, 37, 43, 27, 32, 31, 41],
  5.               [38, 40, 38, 26, 34, 45, 39, 35, 27, 45],
  6.               [27, 50, 26, 42, 26, 49, 22, 37, 21, 44],
  7.               [27, 31, 32, 31, 27, 45, 43, 43, 31, 26],
  8.               [35, 30, 37, 34, 32, 34, 38, 15, 18, 50],
  9.               [17, 25, 24, 43, 31, 22, 29, 42, 43, 35]]
  10.  
  11. def display_data():
  12.     print('Each number represents the numbers of apples produced by the tree in slot.\n')
  13.     print("Tree number: ", tree_number)
  14.     print("Row 1: ",tree_apples[0])
  15.     print("Row 2: ", tree_apples[1])
  16.     print("Row 3: ", tree_apples[2])
  17.     print("Row 4: ", tree_apples[3])
  18.     print("Row 5: ", tree_apples[4])
  19.     print("Row 6: ", tree_apples[5])
  20.     print("Row 7: ", tree_apples[6])
  21.     print("Row 8: ", tree_apples[7])
  22.  
  23.  
  24. def edit():
  25.  
  26.     request_row = int(input("Write the row of the tree: ")) - 1
  27.     request_tree_number = int(input("Write the tree number: ")) - 1
  28.     print("This is the current amount of apples: ", tree_apples[request_row][request_tree_number])
  29.     user_edit = int(input("Write the new number of apples in selected tree: "))
  30.     #tree_apples.insert(tree_apples[request_row][request_tree_number], user_edit)
  31.     list.pop(user_edit,tree_apples[request_row][request_tree_number])
  32.  
  33.     print('The new amount of apples in row:',request_row + 1,'and tree number', request_tree_number + 1, 'is',tree_apples[request_row][request_tree_number])
  34.  
  35. def specific():
  36.     request_row = int(input("Write the row of the tree: ")) - 1
  37.     request_tree_number = int(input("Write the tree number: ")) - 1
  38.     print(tree_apples[request_row][request_tree_number])
  39.  
  40. def main():
  41.     print("Welcome to this brilliant tree application coded in Python.\n")
  42.     print("To view the entire plantation write; all")
  43.     print("To edit a specific tree write; edit")
  44.     print("To view a specific tree write; specific\n")
  45.     user_request = input("Read the lines above before entering anything: ")
  46.  
  47.     if user_request in ["all", "specific", "edit"]:
  48.         if user_request == "all":
  49.             display_data()
  50.  
  51.         elif user_request == "specific":
  52.             specific()
  53.  
  54.         elif user_request == "edit":
  55.             edit()
  56. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement