mavzu: Pythonda funksiyalar. Reja


tyil = input("Tug'ilgan yilingizni kiriting: ")


Download 282.81 Kb.
Pdf ko'rish
bet7/8
Sana21.04.2023
Hajmi282.81 Kb.
#1374722
1   2   3   4   5   6   7   8
Bog'liq
15-mavzu. Pythonda funksiyalar

tyil = input("Tug'ilgan yilingizni kiriting: ")
yosh_hisobla(tyil)
21


Funksiya parametrlari
Traceback (most recent call last):
File
"C:/Users/Hamdam/AppData/Local/Programs/Python/Python39/funktions1.py"
, line 6, in 
yosh_hisobla(tyil)
File
"C:/Users/Hamdam/AppData/Local/Programs/Python/Python39/funktions1.py"
, line 3, in yosh_hisobla
print(f"Siz {joriy_yil-tugilgan_yil} yoshdasiz")
TypeError: unsupported operand type(s) for -: 'int' and 'str'
22


Funksiya parametrlari
def yosh_hisobla(tugilgan_yil, joriy_yil):
"""Foydalanuvchi tug'ilgan yilidan uning yoshini hisoblaydi"""
print(f"Siz {joriy_yil-tugilgan_yil} yoshdasiz")
yosh_hisobla(1993)
23


Funksiya parametrlari
Traceback (most recent call last):
File
"C:/Users/Hamdam/AppData/Local/Programs/Python/Python39/funktions1.py"
, line 5, in 
yosh_hisobla(1993)
TypeError: yosh_hisobla() missing 1 required positional argument: 'joriy_yil'
24


Funksiya parametrlari
def salom_ber():
"""Salom beruvchi funksiya"""
print("Assalomu alaykum!")
salom_ber('hasan')
25


Funksiya parametrlari
Traceback (most recent call last):
File
"C:/Users/Hamdam/AppData/Local/Programs/Python/Python39/funktions1.py"
, line 5, in 
salom_ber('hasan')

Download 282.81 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling