# Тема 5 < Зеленкина Ксения Михайловна> # 2. # Пример 1. porog, rashod1, rashod2 = 3, 120, 50 if rashod1>=porog: dohod=12 elif rashod2==porog: dohod=0 else: dohod=-8 print(dohod) # Пример 2. if rashod1>=3 and rashod2==4: dohod=rashod1 if rashod2==porog or rashod1=4 else 0 print(dohod) # Пример 2 porog = 10 if porog>=5 : rashod1=6; rashod2=0 print(rashod1, rashod2) # 3.1 temperatura=5 for i in range(3,18,3): temperatura+=i print(temperatura) # 3.2 # Пример 1 sps=[2,15,14,8] for k in sps: if len(sps)<=10:sps.append(sps[0]) else:break print(sps) #Пример 2 sps=[2,15,14,8] for k in sps[:]: if len(sps)<=10:sps.append(sps[0]) else:break print(sps) # 3.3 import random as rn sps5=[] for i in range(10): sps5.append(rn.randint(1,100)) ss=sum(sps5) if ss>500: break else: print(ss) # 3.4 stroka='Это – автоматизированная система' stroka1="" for ss in stroka: stroka1+=" "+ss print(stroka1) # 3.5. import math import matplotlib.pyplot as plt sps2=[math.sin(i*math.pi/5+2) for i in range(100)] x = list(range(100)) plt.figure(figsize=(12, 6)) plt.plot(x, sps2, 'b-', linewidth=1, label='sin(i*π/5 + 2)') plt.title('График сигнала: sin(i*π/5 + 2)') plt.xlabel('i (индекс)') plt.ylabel('Значение sin(i*π/5 + 2)') plt.show() # 4.1 rashod=300 while rashod: print("Расход=",rashod) rashod-=50 # 4.2 import math import matplotlib.pyplot as plt stroka='Расчет процесса в объекте регулирования' i=0 sps2=[] while i