X1=int(input('x1='))



Yüklə 27,96 Kb.
tarix08.11.2022
ölçüsü27,96 Kb.
#67914
amaliyot



1.20 – masala. Shaxmat doskasining ikkita turli (x1, y1), (x2, y2) koordinatalari berilgan (1-8- oraliqda yotuvchi butun sonlar). Jumlani rostlikka tekshiring: “Ruh bir yurishda bir maydondan ikkinchisiga o’ta oaldi”.

x1=int(input('x1='))


y1=int(input('y1='))
x2=int(input('x2='))
y2=int(input('y2='))
print(bool((x1>=1 and x1<=8 and y1>=1 and y1<=8 and x2>=8 and y2>=1 and y2<=8)and (abs(y2-y1)==2 or abs(x2-x1)==2 and abs(y2-y1)==1)))
C:\Users\User\PycharmProjects\pythonProject13\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject13/main.py
x1=6
y1=5
x2=8
y2=9
False
Process finished with exit code 0
2.20 - masala. Uchburchakning A va B ikkita tomoni va ular orasidagi burchagi G (radusda) berikgan. Uchburchakning uchinchi tomonini toping. (Hisoblash formulasi: C = √ (A² + B² - 2ABCosG)
import math
print("Uchburchakning tomonlari:")
A=float(input("A="))
B=float(input("B="))
G=float(input("Gradus="))
G=(G*math.pi)/180
S=math.sqrt(A*A+B*B-2*A*B*math.cos(G))
print("Uchburchakning yuzi=",S)

C:\Users\User\PycharmProjects\pythonProject13\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject13/main.py


Uchburchakning tomonlari:
A=7
B=8
Gradus=60
Uchburchakning yuzi= 7.549834435270749
Process finished with exit code 0

3.20 - masala. Kvadrat tenglamaning ildizlarini topuvchi dastur tuzing. Agar Diskreminant<0 bo’lsa, tenglamaning kopleks ildizlarini chiqarsin.


import math,cmath
a=int(input('a='))
b=int(input('b='))
c=int(input('c='))
D=b*b-4*a*c
if a!=0:
if D>0:
x1=(-b+math.sqrt(D))/(2*a)
x2=(-b-math.sqrt(D))/(2*a)
print("Tenglamaning ildizlari:\n",x1,'va',x2)
elif D<0:
x1=(-b+cmath.sqrt(D))/(2*a)
x2=(-b-cmath.sqrt(D))/(2*a)
print("Tenglamaning kompleks ildizlari:\n",x1,'va',x2)
else:
x=-b/(2*a)
print("Tenglamaning ildizi:\n",x)

C:\Users\User\PycharmProjects\pythonProject13\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject13/main.py


a=3
b=7
c=4
Tenglamaning ildizlari:
-1.0 va -1.3333333333333333
Process finished with exit code 0
4.14 – masala. Uchta son berilgan, ularning eng kattasini toping.
x=int(input("Birinchi son\nx="))
y=int(input("Ikkinchi son\ny="))
z=int(input("Uchinchi son\nz="))
if x>y:
max=x
else:max=y
if max>z:
max=max
else:max=z
print("Eng katta son max=",max)
C:\Users\User\PycharmProjects\pythonProject13\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject13/main.py
Birinchi son
x=29
Ikkinchi son
y=20
Uchinchi son
z=24
Eng katta son max= 29
Process finished with exit code 0
5.14 – masala. Teng tomonli uchburchakning elementlari quyidagicha tartibda nomerlangan. 1-tomoni a, 2-ichki chizilgan aylananing radiusi R1 = (a * √3) /6, 3-tashqi chizilgan aylananing radiusi R2 = 2 * R1, 4-yuzasi S = (a² * √3/4). Shu formulalalardan bittasi berilganda qolganlarini topuvchi dastur tuzing.
import math
a=int(input('Teng tomonli uchburchak tomonini kiriting:'))
k=int(input('Teng tomonli uchburchak raqamini kiriting:'))
if k==1:
print('Tomoni',a,'ga teng!')
elif k==2:
R1=(a*math.sqrt(3))/6
print('Uchburchakka ichki chizilgan aylana radiusi',R1,'ga teng!')
elif k==3:
R1=(a*math.sqrt(3))/6
R2=2*R1
print('Uchburchakka tashqi chizilgan aylana radiusi',R2,'ga teng!')
elif k==4:
S=(a*a*math.sqrt(3))/4
print('Uchburchakning yuzi',S,'ga teng!')
else:
print('Teng tomonli uchburchak raqamini 1 dan 4 gacha kiriting!')
C:\Users\User\PycharmProjects\pythonProject14\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject14/main.py
Teng tomonli uchburchak tomonini kiriting:14
Teng tomonli uchburchak raqamini kiriting:4
Uchburchakning yuzi 84.87048957087498 ga teng!
Process finished with exit code 0
6.14 – masala. n butun soni berilgan (n>0). Quyidagi yig’indini hisoblovchi dastur tuzing:
S=1+1/2+1/3+…+1/n.
n=int(input('n='))
s=0
for i in range(1,n+1):
s=s+1/i
print('S=',s)
C:\Users\User\PycharmProjects\pythonProject14\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject14/main.py
n=8
S= 1.0
S= 1.5
S= 1.8333333333333333
S= 2.083333333333333
S= 2.283333333333333
S= 2.4499999999999997
S= 2.5928571428571425
S= 2.7178571428571425
Process finished with exit code 0
7.14 – masala. n butun soni berilgan (n>0). Uni bo’lib butun va qoldiq qismlarini aniqlash orqali, berilgan son raqamlarining orasida 2 raqami bor yoki yo’qligini aniqlovchi dastur tuzing.
n=int(input('n='))
bor=False
while n>0:
x=n%10
n=n/10
if x==2:
bor=True
if bor==True:
print("2 son bor")
else:
print("2 son yoq")
C:\Users\User\PycharmProjects\pythonProject14\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject14/main.py
n=428
2 son yoq
Process finished with exit code 0
8.14 – masala. m va n butun musbat sonlari berilgan. m x n o’lchamli matritsani shunday hosil qilingki, undagi eng kichik elementini toping.
import numpy as np
m=int(input('m='))
n=int(input('n='))
massiv=np.array([[0 for i in range(m) ]for j in range(n)])
for i in range(m):
for j in range(n):
massiv[i][j]=int(input('massiv[i][j]='))
print(massiv.min())
C:\Users\User\PycharmProjects\pythonProject14\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject14/main.py
m=3
n=3
massiv[i][j]=3
massiv[i][j]=4
massiv[i][j]=7
massiv[i][j]=5
massiv[i][j]=2
massiv[i][j]=7
massiv[i][j]=8
massiv[i][j]=4
massiv[i][j]=5
2
Process finished with exit code 0
9.14 – masala. Markazi bir nuqtada bo’lgan, R1 va R2 radiusga ega 2 ta aylananing ustma-ust tushmaydigan (Kesishmaydigan) qismining yuzasini topuvchi RingS nomli funksiya hosil qiling. Doiraning yuzini hisoblash formulasidan foydalaning. S = R² , = 3.1415 ni o’zgarmas deb qabul qiling.
import math
def RingS(a,b):
S=abs(math.pi*math.pow(a,2)-math.pi*math.pow(b,2))
return S
a=int(input('r1='))
b=int(input('r2='))
print('aylanalar kesishmaydigan qismlari yuzasi=',RingS(a,b))
C:\Users\User\PycharmProjects\pythonProject14\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject14/main.py
r1=4
r2=8
aylanalar kesishmaydigan qismlari yuzasi= 150.79644737231007
Process finished with exit code 0
10.20 – masala. Tushirib qoldirilgan harf o’rniga H harfini yozishni o’rgatuvchi dastur tuzing.
matn=str(input("Matn kiriting:"))
b=str(input('Harf kiriting:'))
t=matn.replace(b,"")
print(t)
C:\Users\User\PycharmProjects\pythonProject14\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject14/main.py
Matn kiriting:PythonH dastuHrlashH HtiliH
Harf kiriting:H
Python dasturlash tili
Process finished with exit code 0

Mustaqil bajarish uchun topshiriqlar


Familiya='Xusanova'
Ism='Shahlo'
print(Familiya,Ism)
Yunalish='Amaliy matematika'
print(Yunalish)
Universitet_nomi='Termiz davlat universiteti'
print(Universitet_nomi)
Fakultet_nomi='Axborot texnologiyalari fakulteti'
print(Fakultet_nomi )
Guruh_raqami='201'
print(Guruh_raqami)
a='Ozbekiston kelajagi buyuk davlat!'
print(a)
b='Men PYTHON dasturlash tilini urganmoqchiman'
print(b)
c='ax+b=0'
print(c)
d='sinx+cosx=1'
print(d)
e='tgx+ctgx=1'
print(e)
f='sinx+ctgx=1+cosx'
print(f)
n='ax-by-1=0'
print(n)
Madhiya1='Serquyosh hur ulkam elga baxt najot Sen uzing dustlarga yuldosh mehribon Yashnagay to abad ilmu fan ijod Shuhrating porlasin toki bor jahon'
print(Madhiya1)
Madhiya2='Oltin bu vodiylar jon uzbekiston Ajdodlar mardona ruhi senga yor Uluq xalq qudrati jush urgan zamon Olamni mahliyo aylagan diyor'
print(Madhiya2)
Madhiya3='Bagri keng uzbekning uchmas iymoni Erkin yosh avlodlar senga zor qanot Istiqlol mashali tinchlik posboni Haqsevar ona yurt Mangu bul obod'
print(Madhiya3)
q='ax+by-1=0'
print(q)
p='bx=1-k'
print(p)
l='ax+bx=cz-dk'
print(l)
k='ax+bx-dy=8'
print(k)
h='ax+bx+ck=10'
print(h)
C:\Users\User\PycharmProjects\pythonProject14\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject14/main.py
Xusanova Shahlo
Amaliy matematika
Termiz davlat universiteti
Axborot texnologiyalari fakulteti
201
Ozbekiston kelajagi buyuk davlat!
Men PYTHON dasturlash tilini urganmoqchiman
ax+b=0
sinx+cosx=1
tgx+ctgx=1
sinx+ctgx=1+cosx
ax-by-1=0
Serquyosh hur ulkam elga baxt najot Sen uzing dustlarga yuldosh mehribon Yashnagay to abad ilmu fan ijod Shuhrating porlasin toki bor jahon
Oltin bu vodiylar jon uzbekiston Ajdodlar mardona ruhi senga yor Uluq xalq qudrati jush urgan zamon Olamni mahliyo aylagan diyor
Bagri keng uzbekning uchmas iymoni Erkin yosh avlodlar senga zor qanot Istiqlol mashali tinchlik posboni Haqsevar ona yurt Mangu bul obod
ax+by-1=0
bx=1-k
ax+bx=cz-dk
ax+bx-dy=8
ax+bx+ck=10
Process finished with exit code 0
Yüklə 27,96 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin