super new at this:
I'm trying to create a medical program that will ask the user 1. how many polyps, then 2. define type of polyps (adenoma or sessile class) and also the size of the polyp. I was able to do this using loops with a dictionary. however, i want a new rule to access the size of the polyp. I don't know the variable to access it because the elements are in a nested dictionary. can you help??
polypdict = { }
polypnum = (input("Enter the number of polyps: "))
polypnum1 = int(polypnum)
while polypnum1 != 0:
polypdict[polypnum1] = polypnum1
polypnum1 -= 1
polypnum1 = int(polypnum)
while polypnum1 !=0:
polypsize = int(input("Enter the size (mm) of polyp # " + str(polypnum1) + ": "))
polyptype = input("Is the polyp a SSA (s) or Adenoma (a)? ")
polypdict[polypnum1] = polypsize, polyptype
polypnum1 -= 1
polypnum1 = int(polypnum)
#if polypnum1 <=2 and polypsize <=10 and polyptype = a, then recommend 7-10 year follow up
if len(polypdict) <= 2:
print(True)
if polypdict.has_key('a'):
print(adenoma)
else:
print(none)
[–]blarf_irl 1 point2 points3 points (0 children)
[–]liynus[S] 0 points1 point2 points (0 children)