a1=a%100//10
print(" a1 = ", a1)
17-BILET
3. Foydalanuvchi tomonidan kiritilgan ixtiyoring satrni uzunligi hisoblovchi dastur tuzing.
a ="GULTOJIXO'ROZ"
print(len(a))
18-BILET
3. Yoy uzunligi hisoblash dasturini tuzing.
a = int(input(" burchag: "))
r = int(input(" radiyusi: "))
L=a*r
print("L")
19-BILET
3. a va c berilgan sonlardan a>c bo‘lsa, c dan a gacha bo‘lgan sonlarni o‘sish tartibida , aks holda kamayish tartibida kamayish tartibida chiqaruvchi dastur tuzing
a = int(input(" a = "))
c = int(input(" c = "))
if a>c:
i=c
for i in range(c,a,1):
print(i, end=';')
else:
i=a
for i in range(a,c,1):
print(i, end=';')
20-BILET
3. S=2+4+6+8+…+50 yig‘indini hisoblash dasturini tuzing.
i=2
p=0
while i<=50:
p=p+i
i+=2
print(p)
21-BILET
3. 0 dan 50 gacha bo‘lgan toq sonlarni chiqaruvchi dastur tuzing.
i=1
while i<=50:
print(i)
i+=2
22-BILET
3. 10 va 90 ning oralig‘idan 2 qadam bilan 7 ta tasodifiy sonni chiqaruvchi dastur tuzing.
23-BILET
3. Berilgan 4 xonali sonlar yig‘indisini hisoblash dasturini tuzing.
a = int(input(" 4 xonali son kiriting: "))
a1=a//1000
a2=a%1000//100
a3=a%100//10
a4=a%10
S=a1+a2+a3+a4
print('Natija', S)
24-BILET
3. Aylana radiusi 5 ga teng bo‘lganda, uning uzunligini topish dasturini tuzing. Natijani 2 xona aniqlikda chiqaring.
from math import *
r = int(input(" r = "))
L=2*pi*r
print('Natija',ceil(L))
25-BILET
3. “*” lar yordamida to‘g‘ri to‘rtburchak hosil qilish dasturini tuzing.
print("*"*5)
print("*"*5)
print("*"*5)
print("*"*5)
print("*"*5)
26-BILET
3. x 2 +4x−21=0 kvadrat tenglamani ildizlarini hisoblash dasturini tuzing.
from math import *
a=int(input("a="))
b=int(input("b="))
c=int(input("c="))
D=sqrt(b**2-4*a*c)
if D<0:
print("Yechimi ye'q")
else:
if D==0:
x=-b/2*a
print(x)
else:
x1=(-b-sqrt(D))/2*a
x2=(-b+sqrt(D))/2*a
print('x1 = ',x1,"\nx2 = ",x2 )
27-BILET
3. Python dasturlash tilida (math.floor(math.sqrt(156))+math.ceil(-23.48) ni hisoblang.
from math import *
s=sqrt(156)+ceil(-23.4)
print(s)
-10.510040032
28-BILET
3. Rombning tomoni 5 ga, diagonallaridan biri 6 ga teng. Rombning yuzini hisoblash dasturini tuzing.
from math import *
a=int(input("tomonlari: "))
d1=int(input("diyagnali: "))
d2=sqrt(a**2-d1**2)*2
S=d2*d10/2
print(S)
29-BILET
3. “In”, “ter”, “faol” qism so‘zlaridan so‘z hosil qilib ekranga chiqaring.
a="In"
b="ter"
c="faol"
print(a+b+c)
30-BILET
3. 79 sonini 8 soniga bo‘lganda butun qismini chiqaruvchi dastur tuzing.
a=76
b=8
print(a//b)