форкнуто от main/python-labs
Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
138 строки
4.2 KiB
Python
138 строки
4.2 KiB
Python
Python 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)] on win32
|
|
Enter "help" below or click "Help" above for more information.
|
|
porog=4
|
|
rashod1=7
|
|
rashod2=11
|
|
if rashod1>=porog:
|
|
dohod=12
|
|
elif rashod2==porog:
|
|
dohod=0
|
|
else:
|
|
dohod=-8
|
|
|
|
dohod
|
|
12
|
|
if rashod1>=3 and rashod2==4:
|
|
dohod=rashod1
|
|
if rashod2==porog or rashod1<rashod2:
|
|
dohod=porog
|
|
|
|
dohod
|
|
12
|
|
del dohod
|
|
if rashod1>=3 and rashod2==4:
|
|
dohod=rashod1
|
|
if rashod2==porog or rashod1<rashod2:
|
|
dohod=porog
|
|
|
|
|
|
dohod
|
|
Traceback (most recent call last):
|
|
File "<pyshell#10>", line 1, in <module>
|
|
dohod
|
|
NameError: name 'dohod' is not defined
|
|
if porog==3:
|
|
dohod=1
|
|
elif porog==4:
|
|
dohod=2
|
|
elif porog==5:
|
|
dohod=3
|
|
else:
|
|
dohod=0
|
|
|
|
dohod
|
|
2
|
|
del dohod
|
|
dohod=2 if porog>=4 else 0
|
|
dohod
|
|
2
|
|
if porog>=5 : rashod1=6; rashod2=0
|
|
|
|
rashod1
|
|
7
|
|
rashod2
|
|
11
|
|
temperatura=5
|
|
for i in range(3,18,3):
|
|
temperatura+=i
|
|
|
|
SyntaxError: multiple statements found while compiling a single statement
|
|
temperatura=5
|
|
for i in range(3,18,3):
|
|
temperatura+=i
|
|
|
|
|
|
temperatura
|
|
50
|
|
sps=[2,15,14,8]
|
|
for k in sps:
|
|
if len(sps)<=10:sps.append(sps[0])
|
|
else:break
|
|
|
|
|
|
sps
|
|
[2, 15, 14, 8, 2, 2, 2, 2, 2, 2, 2]
|
|
sps=[2,15,14,8]
|
|
for k in sps[:]:
|
|
if len(sps)<=10:sps.append(sps[0])
|
|
else:break
|
|
|
|
sps
|
|
[2, 15, 14, 8, 2, 2, 2, 2]
|
|
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)
|
|
|
|
369
|
|
for i in range(10):
|
|
sps5.append(rn.randint(1,100))
|
|
ss=sum(sps5)
|
|
if ss>500: break
|
|
else:
|
|
print(ss)
|
|
|
|
|
|
sps5=[]
|
|
for i in range(10):
|
|
sps5.append(rn.randint(1,100))
|
|
ss=sum(sps5)
|
|
if ss>500: break
|
|
else:
|
|
print(ss)
|
|
|
|
|
|
438
|
|
sps5=[]
|
|
for i in range(10):
|
|
sps5.append(rn.randint(1,100))
|
|
ss=sum(sps5)
|
|
if ss>500: break
|
|
else:
|
|
print(ss)
|
|
|
|
|
|
495
|
|
stroka='Это – автоматизированная система'
|
|
stroka1=""
|
|
for ss in stroka:
|
|
stroka1+=" "+ss
|
|
|
|
SyntaxError: multiple statements found while compiling a single statement
|
|
stroka='Это – автоматизированная система'
|
|
stroka1=""
|
|
for ss in stroka:
|
|
stroka1+=" "+ss
|
|
|
|
|
|
>>> stroka1
|
|
' Э т о – а в т о м а т и з и р о в а н н а я с и с т е м а'
|
|
>>> import math
|
|
>>> sps2=[math.sin(i*math.pi/5+2) for i in range(100)]
|
|
>>> sps2
|
|
[0.9092974268256817, 0.49103209793281005, -0.11479080280322804, -0.6767675184643197, -0.9802420445539634, -0.9092974268256817, -0.49103209793281016, 0.11479080280322791, 0.6767675184643196, 0.9802420445539634, 0.9092974268256818, 0.4910320979328103, -0.1147908028032278, -0.6767675184643196, -0.9802420445539632, -0.9092974268256818, -0.4910320979328104, 0.11479080280322768, 0.6767675184643195, 0.9802420445539632, 0.9092974268256819, 0.4910320979328105, -0.11479080280322579, -0.6767675184643194, -0.9802420445539632, -0.9092974268256819, -0.4910320979328106, 0.11479080280322743, 0.6767675184643193, 0.9802420445539632, 0.909297426825682, 0.49103209793281066, -0.1147908028032273, -0.6767675184643192, -0.9802420445539632, -0.909297426825682, -0.4910320979328108, 0.11479080280322719, 0.6767675184643192, 0.9802420445539631, 0.9092974268256822, 0.491032097932814, -0.11479080280322707, -0.676767518464319, -0.9802420445539625, -0.9092974268256822, -0.491032097932811, 0.11479080280323047, 0.6767675184643189, 0.9802420445539625, 0.9092974268256822, 0.4910320979328142, -0.11479080280322682, -0.6767675184643215, -0.9802420445539631, -0.9092974268256808, -0.4910320979328112, 0.11479080280322317, 0.6767675184643187, 0.9802420445539624, 0.9092974268256823, 0.4910320979328082, -0.11479080280322658, -0.6767675184643213, -0.980242044553963, -0.9092974268256838, -0.49103209793281144, 0.11479080280322293, 0.6767675184643186, 0.9802420445539637, 0.9092974268256824, 0.49103209793280844, -0.11479080280322633, -0.6767675184643158, -0.980242044553963, -0.9092974268256839, -0.49103209793281166, 0.11479080280322974, 0.6767675184643184, 0.9802420445539637, 0.9092974268256825, 0.4910320979328149, -0.11479080280321903, -0.6767675184643209, -0.9802420445539629, -0.909297426825681, -0.4910320979328119, 0.11479080280322244, 0.6767675184643129, 0.9802420445539636, 0.9092974268256826, 0.49103209793281505, -0.11479080280322584, -0.6767675184643155, -0.9802420445539644, -0.9092974268256812, -0.49103209793281205, 0.1147908028032222, 0.6767675184643127, 0.980242044553965]
|