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