cim_db = [] cim_ter = [] var = True while var: ip = input("Ip cím: ") if ip[1] != '.': if ip[2] != '.': if ip[3] != '.': print('Ez nem ip cím') else: var = False else: var = False else: var = False ip_darabolas = [] ip_maradvany = '' for i in range(len(ip)): if ip[i] == '.': ip_darabolas.append(ip_maradvany) ip_maradvany = '' else: ip_maradvany += ip[i] resz_db = int(input('Eszközök száma: ')) for i in range(1,resz_db+1): print(i,'. ', end='') cim_db.append(int(input(' Címtér: '))) cim_db.sort(reverse=True) for i in range(len(cim_db)): if cim_db[i] <= 4: cim_ter.append(4) elif cim_db[i] <= 8: cim_ter.append(8) elif cim_db[i] <= 16: cim_ter.append(16) elif cim_db[i] <= 32: cim_ter.append(32) elif cim_db[i] <= 64: cim_ter.append(64) elif cim_db[i] <= 128: cim_ter.append(128) print('Szám ---- Halozati cim ---- Szorasi cim ---- Elso cim ---- Utolso cim ---- Maszk') maszk = [] for i in range(len(cim_ter)): if cim_ter[i] == 128: maszk.append('/25') if cim_ter[i] == 64: maszk.append('/26') if cim_ter[i] == 32: maszk.append('/27') if cim_ter[i] == 16: maszk.append('/28') if cim_ter[i] == 8: maszk.append('/29') if cim_ter[i] == 4: maszk.append('/30') h = 0 sz = -1 e = 1 u = -2 for i in range(len(cim_db)): sz += cim_ter[i] u += cim_ter[i] print(cim_ter[i], '----' ,ip_darabolas[0], '.' ,ip_darabolas[1], '.' ,ip_darabolas[2], '.' ,h, '----' ,ip_darabolas[0], '.' ,ip_darabolas[1], '.' ,ip_darabolas[2], '.' ,sz, '----' ,ip_darabolas[0], '.', ip_darabolas[1] ,'.', ip_darabolas[2] ,'.' ,e, '----' ,ip_darabolas[0] ,'.' ,ip_darabolas[1], '.', ip_darabolas[2], '.' ,u, '---' ,maszk[i]) h += cim_ter[i] e += cim_ter[i]