Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mustafamuratcoskun
GitHub Repository: mustafamuratcoskun/Sifirdan-Ileri-Seviyeye-Python-Programlama
Path: blob/master/Fonksiyonlar/Videolardaki Notebooklar/Fonksiyonlarda Parametre Türleri.ipynb
765 views
Kernel: Python 3
def selamla(isim): print("Selam",isim)
selamla("Murat")
Selam Murat
selamla("Serhat")
Selam Serhat
selamla()
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-10-4ac1fb28ba12> in <module>() ----> 1 selamla() TypeError: selamla() missing 1 required positional argument: 'isim'
def selamla(isim = "İsimsiz"): print("Selam",isim)
selamla()
Selam İsimsiz
selamla("Murat")
Selam Murat
def bilgilerigoster(ad,soyad,numara): print("Ad:",ad,"Soyad:",soyad,"Numara:",numara)
bilgilerigoster("Mustafa Murat","Coşkun","12345")
Ad: Mustafa Murat Soyad: Coşkun Numara: 12345
def bilgilerigoster(ad = "Bilgi Yok",soyad = "Bilgi Yok",numara = "Bilgi Yok"): print("Ad:",ad,"Soyad:",soyad,"Numara:",numara)
bilgilerigoster()
Ad: Bilgi Yok Soyad: Bilgi Yok Numara: Bilgi Yok
bilgilerigoster("Mustafa Murat","Coşkun")
Ad: Mustafa Murat Soyad: Coşkun Numara: Bilgi Yok
bilgilerigoster(numara = "12345")
Ad: Bilgi Yok Soyad: Bilgi Yok Numara: 12345
print("Mustafa","Murat","Coşkun")
Mustafa Murat Coşkun
print("Mustafa","Murat","Coşkun",sep = "/")
Mustafa/Murat/Coşkun
help(print)
Help on built-in function print in module builtins: print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.
def toplama(a,b,c): print(a+b+c)
toplama(3,4,5)
12
toplama(3,4,5,6)
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-54-ae6c3d3b8e68> in <module>() ----> 1 toplama(3,4,5,6) TypeError: toplama() takes 3 positional arguments but 4 were given
def toplama(*a): print(a)
toplama(1,2,3)
(1, 2, 3)
toplama(3,4,5,6,7)
(3, 4, 5, 6, 7)
def toplama(*a): toplam = 0 for i in a: toplam += i print(toplam)
toplama(1,2,3)
6
toplama(3,4,5,6,7,8,9,10,11)
63
print("Murat")
Murat
print("Murat","Coşkun")
Murat Coşkun
print(3,4,5,6,7)
3 4 5 6 7
help(print)
Help on built-in function print in module builtins: print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.