The program should output a fragment of the multiplication table for all numbers of the segment [a; b] to all the numbers of the segment [c; d]. The numbers a, b, c and d are natural and do not exceed 10, a≤b, c≤d. I started, but I don’t know how to finish.

a = int(input()) b = int(input()) c = int(input()) d = int(input()) s='' if a<=b and c<=d: for i in range (c, d+1): s=s+[i] print('\t',i,end='') for i in range(a, b+1): print('\n',i,'\t',s[0]*i,'\t',end='') 

    2 answers 2

    If the task says "a b b, c" d ", then it is so, additional checks of the type if a<=b and c<=d can be omitted.

     # ввод данных a = int(input()) b = int(input()) c = int(input()) d = int(input()) # приводим ввод к форме a≤b, c≤d, необязательный шаг (смотри выше) # a, b = (b, a) if a > b else (a, b) # c, d = (d, c) if c > d else (c, d) s = '' # формируем шапку таблицы for i in range (c, d + 1): s += '\t%s' % i # заполняем строки таблицы for i in range(a, b + 1): s += '\n%s' % i # выводим текущее число из умножаемого столбеца for j in range (c, d + 1): s += '\t%s' % (i * j) # выводим результат умножения соответствующих чисел print(s) 
       #Ввод данных a = int(input()) b = int(input()) c = int(input()) d = int(input()) #начало Цикла for g in range (c,d+1): print('\t'+str(g),end='') print(end='\n') for i in range (a,b+1): print(str(i)+'\t',end='') for j in range (c,d+1): print(str(i * j),end='\t')# выводим результат умножения соответствующих чисел в таблицу print(end='\n') 
      • 2
        What is your answer is fundamentally different from the existing one? - insolor