Skip to content

Instantly share code, notes, and snippets.

@rashmibanthia
Created June 5, 2016 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rashmibanthia/1dcb57f24f605d5aa889c048a5150197 to your computer and use it in GitHub Desktop.
Save rashmibanthia/1dcb57f24f605d5aa889c048a5150197 to your computer and use it in GitHub Desktop.
#XML 1 - Find the score
import xml.etree.ElementTree as etree
N = int(input())
xml = ""
for i in range(0,N):
xml = xml + str(input().strip())
score = 0
tree = etree.ElementTree(etree.fromstring(xml))
score = score + len(tree.getroot().attrib)
for i in tree.findall('.//'):
score = score + len(i.attrib)
print(score)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment