Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Практика 2 Студент: Кондаков Тимофей Михайлович Группа: БСБО-08-19
- list = ["Бит", "КБит", "МБит", "ГБит", "ТБит",
- "ПБит", "ЭБит", "ЗБит", "ЙБит", "Байт",
- "КБайт", "МБайт", "ГБайт", "ТБайт", "ПБайт",
- "ЭБайт", "ЗБайт", "ЙБайт", ]
- i = 0
- bit = 1
- value = bit
- for i in range(len(list)):
- if "Бит" in list[i]:
- print("-------------------------------------------------------------------------------------------")
- j = 0
- if i == 1:
- value = 1024
- elif i != 0:
- k = 0
- while True:
- if k > i:
- break
- value *= 1024
- k += 1
- while True:
- if j > i:
- break
- value_text = str(value)
- print("1 " + list[i] + " = " + value_text + " " + list[j] )
- value /= 1024
- j += 1
- value_max = 0
- if "Байт" in list[i]:
- print("-------------------------------------------------------------------------------------------")
- # print(value)
- # print(value_max)
- j = 0
- value = 8
- # if i == 9:
- # value = 8
- if i != 0:
- k = 0
- while True:
- if k > i - 10:
- value_max = value
- break
- value *= 1024
- #print(value)
- k += 1
- while True:
- #print(i)
- if j > i:
- value = value_max
- break
- if "Байт" in list[j]:
- k = 0
- value = 1
- while True:
- if k > i - 10:
- break
- value *= 1024
- #print(value)
- k += 1
- #print(value)
- if j - 9 != 0:
- value /= 1024 ** (j - 9)
- #print(j)
- value_text = str(value)
- print("1 " + list[i] + " = " + value_text + " " + list[j])
- # k1 = 0
- # while True:
- # value_text = str(value)
- # print("1 " + list[i] + " = " + value_text + " " + list[j])
- # if k1 > i - 10:
- # break
- # value /= 1024
- # print(value)
- # k1 += 1
- else:
- value_text = str(value)
- print("1 " + list[i] + " = " + value_text + " " + list[j])
- value /= 1024
- j += 1
- i += 1
- # i = 0
- # bit = 1
- # value = bit
- #
- # for i in range(len(list)):
- # value *= 1024 * i
- #
- # if "Бит" in list[i]:
- # value *= 8
- # k = 0
- # for k in range(1, len(list)/2 + 1):
- # value *= 1024 * i
- #
- # j = 0
- # while j != i+1:
- # # print(j)
- # # print(i)
- # value_text = value
- # value_text /= (1024 * (i+1))
- # value_text = str(value)
- # print("1 "+list[i]+" = "+value_text+list[j])
- # j += 1
- #
- # # elif "Байт" in list[i]:
- # # value *= 8
- # # print(list[i])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement