# Calling arguments: plant_catalog.xml plantName percentChange
import xml.etree.ElementTree as ET
import sys
# input parameters
searchName = sys.argv[2]
percent = float(sys.argv[3])
# parse XML data file
tree = ET.parse(sys.argv[1])
root = tree.getroot()
# change rate
change_rate = (percent + 100) / 100
for plant in root.findall("./COMMON"):
if plant.text == searchName:
new_price = float(root.find("./PRICE").text)
new_price = str(round((new_price * change_rate),2))
root.find("./PRICE").text = new_price
tree.write('output.xml')