import random as rd
def genEx():
adds = [rd.randint(1,100) for i in range(2)]
string = '{0} + {1}'.format(adds[0], adds[1])
return string
def main():
counter = 0
for i in range(5):
example = genEx()
answer = input('{0} = \n'.format(example))
correctAnswer = eval(example)
if int(answer) == int(correctAnswer):
counter += 1
print('Ready. True answers: {}'.format(counter))
if __name__ == '__main__':
main()
Объяснение:
Скриншот приложен для восстановления изначального вида программы. Копировать не советую, сайт ломает пробелы. Если есть вопросы, с радостью отвечу
1.
156₁₀ = 6*10⁰ + 5*10¹ + 1*10²
236₈ = 6*8⁰ + 3*8¹ + 2*8²
185,463₁₀ = 5*10⁰ + 8*10¹ + 1*10² + 4/10¹ + 6/10² + 3/10³
2013,125₈ = 3*8⁰ + 1*8¹ + 0*8² + 2*8³ + 1/10¹ + 2/10² + 5/10³
2.
123₁₀ = 1111011₂ = 173₈ = 7B₁₆
456₁₀ = 111001000₂ = 710₈ = 1C8₁₆
234₁₀ = 11101010₂ = 352₈ = EA₁₆
256₁₀ = 100000000₂ = 400₈ = 100₁₆
3.
101001₂ + 1111₂ = 111000₂ = 70₈ = 38₁₆
11111₂ + 111₂ = 100110₂ = 46₈ = 26₁₆
111₂ * 110₂ = 101010₂ = 52₈ = 2A₁₆
101₂ * 111₂ = 100011₂ = 43₈ = 23₁₆
123₁₀ = 1*2⁰ + 1*2¹ + 0*2² + 1*2³ + 1*2⁴ + 1*2⁵ + 1*2⁶ = 1111011₂
123₁₀ = 3*8⁰ + 7*8¹ + 1*8² = 173₈
123₁₀ = 11*16⁰ + 7*16¹ = 7B₁₆
7B₁₆ = B*16⁰ + 7*16¹ = 123₁₀
456₁₀ = 0*2⁰ + 0*2¹ + 0*2² + 1*2³ + 0*2⁴ + 0*2⁵ + 1*2⁶ + 1*2⁷ + 1*2⁸ = 111001000₂
456₁₀ = 0*8⁰ + 1*8¹ + 7*8² = 710₈
456₁₀ = 8*16⁰ + 12*16¹ + 1*16² = 1C8₁₆
1C8₁₆ = 8*16⁰ + C*16¹ + 1*16² = 456₁₀
234₁₀ = 0*2⁰ + 1*2¹ + 0*2² + 1*2³ + 0*2⁴ + 1*2⁵ + 1*2⁶ + 1*2⁷ = 11101010₂
234₁₀ = 2*8⁰ + 5*8¹ + 3*8² = 352₈
234₁₀ = 10*16⁰ + 14*16¹ = EA₁₆
EA₁₆ = A*16⁰ + E*16¹ = 234₁₀
256₁₀ = 0*2⁰ + 0*2¹ + 0*2² + 0*2³ + 0*2⁴ + 0*2⁵ + 0*2⁶ + 0*2⁷ + 1*2⁸ = 100000000₂
256₁₀ = 0*8⁰ + 0*8¹ + 4*8² = 400₈
256₁₀ = 0*16⁰ + 0*16¹ + 1*16² = 100₁₆
100₁₆ = 0*16⁰ + 0*16¹ + 1*16² = 256₁₀
101001₂ = 1*2⁰ + 0*2¹ + 0*2² + 1*2³ + 0*2⁴ + 1*2⁵ = 41₁₀
1111₂ = 1*2⁰ + 1*2¹ + 1*2² + 1*2³ = 15₁₀
56₁₀ = 0*8⁰ + 7*8¹ = 70₈
56₁₀ = 8*16⁰ + 3*16¹ = 38₁₆
11111₂ = 1*2⁰ + 1*2¹ + 1*2² + 1*2³ + 1*2⁴ = 31₁₀
111₂ = 1*2⁰ + 1*2¹ + 1*2² = 7₁₀
38₁₀ = 6*8⁰ + 4*8¹ = 46₈
38₁₀ = 6*16⁰ + 2*16¹ = 26₁₆
110₂ = 0*2⁰ + 1*2¹ + 1*2² = 6₁₀
42₁₀ = 2*8⁰ + 5*8¹ = 52₈
42₁₀ = 10*16⁰ + 2*16¹ = 2A₁₆
101₂ = 1*2⁰ + 0*2¹ + 1*2² = 5₁₀
35₁₀ = 3*8⁰ + 4*8¹ = 43₈
35₁₀ = 3*16⁰ + 2*16¹ = 23₁₆
import random as rd
def genEx():
adds = [rd.randint(1,100) for i in range(2)]
string = '{0} + {1}'.format(adds[0], adds[1])
return string
def main():
counter = 0
for i in range(5):
example = genEx()
answer = input('{0} = \n'.format(example))
correctAnswer = eval(example)
if int(answer) == int(correctAnswer):
counter += 1
print('Ready. True answers: {}'.format(counter))
if __name__ == '__main__':
main()
Объяснение:
Скриншот приложен для восстановления изначального вида программы. Копировать не советую, сайт ломает пробелы. Если есть вопросы, с радостью отвечу
1.
156₁₀ = 6*10⁰ + 5*10¹ + 1*10²
236₈ = 6*8⁰ + 3*8¹ + 2*8²
185,463₁₀ = 5*10⁰ + 8*10¹ + 1*10² + 4/10¹ + 6/10² + 3/10³
2013,125₈ = 3*8⁰ + 1*8¹ + 0*8² + 2*8³ + 1/10¹ + 2/10² + 5/10³
2.
123₁₀ = 1111011₂ = 173₈ = 7B₁₆
456₁₀ = 111001000₂ = 710₈ = 1C8₁₆
234₁₀ = 11101010₂ = 352₈ = EA₁₆
256₁₀ = 100000000₂ = 400₈ = 100₁₆
3.
101001₂ + 1111₂ = 111000₂ = 70₈ = 38₁₆
11111₂ + 111₂ = 100110₂ = 46₈ = 26₁₆
111₂ * 110₂ = 101010₂ = 52₈ = 2A₁₆
101₂ * 111₂ = 100011₂ = 43₈ = 23₁₆
Объяснение:
2.
123₁₀ = 1*2⁰ + 1*2¹ + 0*2² + 1*2³ + 1*2⁴ + 1*2⁵ + 1*2⁶ = 1111011₂
123₁₀ = 3*8⁰ + 7*8¹ + 1*8² = 173₈
123₁₀ = 11*16⁰ + 7*16¹ = 7B₁₆
7B₁₆ = B*16⁰ + 7*16¹ = 123₁₀
123₁₀ = 3*8⁰ + 7*8¹ + 1*8² = 173₈
123₁₀ = 1*2⁰ + 1*2¹ + 0*2² + 1*2³ + 1*2⁴ + 1*2⁵ + 1*2⁶ = 1111011₂
456₁₀ = 0*2⁰ + 0*2¹ + 0*2² + 1*2³ + 0*2⁴ + 0*2⁵ + 1*2⁶ + 1*2⁷ + 1*2⁸ = 111001000₂
456₁₀ = 0*8⁰ + 1*8¹ + 7*8² = 710₈
456₁₀ = 8*16⁰ + 12*16¹ + 1*16² = 1C8₁₆
1C8₁₆ = 8*16⁰ + C*16¹ + 1*16² = 456₁₀
456₁₀ = 0*8⁰ + 1*8¹ + 7*8² = 710₈
456₁₀ = 0*2⁰ + 0*2¹ + 0*2² + 1*2³ + 0*2⁴ + 0*2⁵ + 1*2⁶ + 1*2⁷ + 1*2⁸ = 111001000₂
234₁₀ = 0*2⁰ + 1*2¹ + 0*2² + 1*2³ + 0*2⁴ + 1*2⁵ + 1*2⁶ + 1*2⁷ = 11101010₂
234₁₀ = 2*8⁰ + 5*8¹ + 3*8² = 352₈
234₁₀ = 10*16⁰ + 14*16¹ = EA₁₆
EA₁₆ = A*16⁰ + E*16¹ = 234₁₀
234₁₀ = 2*8⁰ + 5*8¹ + 3*8² = 352₈
234₁₀ = 0*2⁰ + 1*2¹ + 0*2² + 1*2³ + 0*2⁴ + 1*2⁵ + 1*2⁶ + 1*2⁷ = 11101010₂
256₁₀ = 0*2⁰ + 0*2¹ + 0*2² + 0*2³ + 0*2⁴ + 0*2⁵ + 0*2⁶ + 0*2⁷ + 1*2⁸ = 100000000₂
256₁₀ = 0*8⁰ + 0*8¹ + 4*8² = 400₈
256₁₀ = 0*16⁰ + 0*16¹ + 1*16² = 100₁₆
100₁₆ = 0*16⁰ + 0*16¹ + 1*16² = 256₁₀
256₁₀ = 0*8⁰ + 0*8¹ + 4*8² = 400₈
256₁₀ = 0*2⁰ + 0*2¹ + 0*2² + 0*2³ + 0*2⁴ + 0*2⁵ + 0*2⁶ + 0*2⁷ + 1*2⁸ = 100000000₂
3.
101001₂ = 1*2⁰ + 0*2¹ + 0*2² + 1*2³ + 0*2⁴ + 1*2⁵ = 41₁₀
1111₂ = 1*2⁰ + 1*2¹ + 1*2² + 1*2³ = 15₁₀
56₁₀ = 0*8⁰ + 7*8¹ = 70₈
56₁₀ = 8*16⁰ + 3*16¹ = 38₁₆
11111₂ = 1*2⁰ + 1*2¹ + 1*2² + 1*2³ + 1*2⁴ = 31₁₀
111₂ = 1*2⁰ + 1*2¹ + 1*2² = 7₁₀
38₁₀ = 6*8⁰ + 4*8¹ = 46₈
38₁₀ = 6*16⁰ + 2*16¹ = 26₁₆
111₂ = 1*2⁰ + 1*2¹ + 1*2² = 7₁₀
110₂ = 0*2⁰ + 1*2¹ + 1*2² = 6₁₀
42₁₀ = 2*8⁰ + 5*8¹ = 52₈
42₁₀ = 10*16⁰ + 2*16¹ = 2A₁₆
101₂ = 1*2⁰ + 0*2¹ + 1*2² = 5₁₀
111₂ = 1*2⁰ + 1*2¹ + 1*2² = 7₁₀
35₁₀ = 3*8⁰ + 4*8¹ = 43₈
35₁₀ = 3*16⁰ + 2*16¹ = 23₁₆