pilastri = [
    {"elemento": "P01", "N": 450, "V": 120, "M": 85},
    {"elemento": "P02", "N": -820, "V": 180, "M": 140},
    {"elemento": "P03", "N": 750, "V": 95, "M": 110}
]


travi = [
    {"elemento": "T01", "N": 0, "V": 500, "M": 85},
    {"elemento": "T02", "N": 0, "V": -450, "M": 140},
    {"elemento": "T03", "N": 0, "V": 550, "M": -260},
    {"elemento": "T04", "N": 0, "V": 180, "M": 122},
    {"elemento": "T05", "N": 0, "V": 254, "M": 110}
]


lista_vuota = [
   
]

travinc = [
    {"elemento": "T01", "V": 500, "M": 85},
    {"elemento": "T02", "N": 0, "V": -450, "M": 140},
    {"elemento": "T03", "N": 0,  "M": -260},
    {"elemento": "T04", "N": 0, "V": 180, "M": 122},
    {"elemento": "T05", "N": 0, "V": 254, "M": 110}
]

def analizza_elementi(generic_frames):

    if not generic_frames:
        print("Errore: nessun elemento da analizzare")
        return None

  

    Nabsmax =0
    Mabsmax =0
    Vabsmax =0
    Ntemp=0
    Mtemp=0
    Vtemp=0
    Noriginal=0
    Moriginal=0
    Voriginal=0
    frame_max_N= 0
    frame_max_V = 0
    frame_max_M = 0
    cnt=0


    for element in generic_frames:

        check_elemento=element.get("elemento")
        check_N=element.get("N")
        check_V=element.get("V")
        check_M=element.get("M")
        cnt=cnt+1


         if check_elemento==None
            printf("L'elemento numero {cnt} è privo di nome")
        
         if check_N==None
            printf("Per l'elemento {check_elemento} è assente il valore N")

         if check_V==None
            printf("Per l'elemento {check_elemento} è assente il valore V")

         if check_M==None
            printf("Per l'elemento {check_elemento} è assente il valore M")
        
       

    for element in generic_frames:
        
            
        Ntemp=abs(element["N"])
        Vtemp=abs(element["V"])
        Mtemp=abs(element["M"])

        if (Ntemp>Nabsmax):
            Nabsmax = Ntemp
            frame_max_N = element["elemento"]
            Noriginal=element["N"]
            
        if (Vtemp>Vabsmax):
            Vabsmax = Vtemp
            frame_max_V = element["elemento"]    
            Voriginal=element["V"]
  
        if (Mtemp>Mabsmax):
            Mabsmax = Mtemp
            frame_max_M = element["elemento"]   
            Moriginal=element["M"]

    return(frame_max_N,frame_max_M,frame_max_V,Nabsmax,Mabsmax,Vabsmax,Noriginal,Moriginal,Voriginal)

risultati= analizza_elementi(travinc)


if risultati is not None:

    el_n,el_m,el_v,nmax,mmax,vmax,nmaxsign,mmaxsign,vmaxsign = risultati
    
    print("Elemento con Nmax in valore assoluto =", el_n)
    print("Nmax in valore assoluto=", nmax, "kN")
    print("Nmax con segno=", nmaxsign, "kN")
    print("Elemento con Vmax in valore assoluto =", el_v)
    print("Vmax in valore assoluto=", vmax, "kN")
    print("Vmax con segno=", vmaxsign, "kN")
    print("Elemento con Mmax in valore assoluto =", el_m)
    print("Mmax in valore assoluto=", mmax, "kNm")
    print("Mmax con segno=", mmaxsign, "kNm")

else:
    print("La lista fornita non è correttamente formattata o vuota")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: