Ana sayfa Genel Python – Fonksiyonlarda Parametre Türleri

Python – Fonksiyonlarda Parametre Türleri

8323
898
PAYLAŞ

Fonksiyonlarda Parametre Türleri

Bu derste fonksiyonlara parametre vermenin farklı yollarını öğrenmeye çalışacağız. İsterseniz hemen başlayalım.

Parametrelerin Varsayılan Değerleri

Biliyorsunuz önceki konularda şöyle bir fonksiyon tanımlamıştık.

Ancak biz eğer bir parametrenin değerini varsayılan olarak belirlemek istersek, bunu varsayılan değerler ile yapabiliriz. Varsayılan değerleri anlamak için selamla fonksiyonunu varsayılan parametre değeri ile yazalım.

İşte bu kadar ! Peki birçok parametreye sahip olursak ne olacak ? Bir fonksiyon daha tanımlayalım.

Ancak böyle bir durumda argümanları gönderirken değerleri sıralı vermemiz gerekiyor. Peki sadece numara parametresine değer vermek istersek ne yapacağız ?

Aslında biz varsayılan değerleri kursumuzun en başlarında görmüştük. print fonksiyonunun sep parametresini hatırlayalım.

Esnek Sayıda Değerler

Biliyorsunuz bir fonksiyon yazıldığında özel olarak kaç tane parametresi olacağını önceden belirtmemiz gerekiyor. Örneğin, bir toplama fonksiyonu yazalım.

Eğer bu fonksiyonu 4 argüman alacak şekilde tanımlamak istersek, tekrardan tanımlamamız gerekiyor.





Peki ben bir fonksiyonu esnek sayıda argümanla kullanmak istersem ne yapacağım ? Bunun için de Yıldızlı Parametre kullanmam gerekiyor. Kullanımı şu şekildedir;




print fonksiyonunu tekrar hatırlayacak olursak aslında print fonksiyonu bu şekilde tanımlanmış bir fonksiyondur. Çünkü biz print fonksiyonuna istediğimiz sayıda argüman gönderebiliyorduk.



Bu konuda gördüğümüz gibi Python’ın bu özelliklerini kullanarak daha esnek fonksiyonlar yazabiliriz. Bir sonraki konuda Global ve Yerel değişkenleri öğrenmeye çalışacağız.

 

898 YORUMLAR

  1. hello!,I really like your writing so so much!
    share we be in contact more about your post
    on AOL? I require an expert on this space to resolve my problem.
    May be that is you! Looking ahead to look you.

  2. Hi there! This is kind of off topic but I need some advice from an established blog. Is it tough to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about creating my own but I’m not sure where to start. Do you have any tips or suggestions? Thanks

  3. I intended to compose you a tiny note to be able to say thanks a lot over again over the extraordinary information you’ve provided on this site. This has been tremendously generous of people like you to present unreservedly precisely what many individuals could possibly have distributed for an e-book to help with making some money for their own end, most importantly now that you might well have done it if you decided. The techniques in addition acted to provide a great way to be certain that the rest have the same dream just as my personal own to understand good deal more pertaining to this condition. I think there are several more fun occasions in the future for individuals that see your site.

  4. Can I simply say what a reduction to seek out somebody who truly knows what theyre talking about on the internet. You positively know how you can convey a problem to gentle and make it important. More individuals have to learn this and understand this facet of the story. I cant believe youre no more well-liked since you definitely have the gift.

  5. My programmer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using Movable-type on a
    variety of websites for about a year and am
    anxious about switching to another platform. I have heard great things
    about blogengine.net. Is there a way I can import
    all my wordpress posts into it? Any help would be really appreciated!

  6. Greetings! Quick question that’s completely off topic. Do you know how to make your site mobile friendly? My blog looks weird when viewing from my iphone4. I’m trying to find a theme or plugin that might be able to resolve this issue. If you have any suggestions, please share. Thank you!

  7. An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading more on this topic. If possible, as you become expertise, would you mind updating your blog with more details? It is highly helpful for me. Big thumb up for this blog post!

  8. Heya just wanted to give you a brief heads up and let you know a few of the images aren’t loading properly. I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and both show the same results.

  9. Thanks for sharing excellent informations. Your site is very cool. I am impressed by the details that you¦ve on this web site. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for extra articles. You, my friend, ROCK! I found just the information I already searched all over the place and just could not come across. What a perfect site.

  10. I am really impressed with your writing skills as well as with the layout on your weblog.
    Is this a paid theme or did you modify it yourself?
    Anyway keep up the excellent quality writing, it’s rare
    to see a nice blog like this one today.

  11. Hey There. I discovered your weblog using msn. That is an extremely neatly written article.
    I’ll be sure to bookmark it and come back to read more of your helpful information. Thank you for the post.
    I’ll certainly return.

  12. I have read a few good stuff here. Definitely worth bookmarking for revisiting.
    I surprise how so much attempt you put to create this kind of magnificent informative site.

  13. Please let me know if you’re looking for a article author for your site.

    You have some really good articles and I think I would be a
    good asset. If you ever want to take some of the load off,
    I’d really like to write some material for your blog in exchange
    for a link back to mine. Please blast me an email if interested.
    Many thanks!

  14. Appreciating the hard work you put into your site and in depth information you offer. It’s nice to come across a blog every once in a while that isn’t the same unwanted rehashed material. Fantastic read! I’ve saved your site and I’m including your RSS feeds to my Google account.

  15. hi!,I love your writing so a lot! proportion we be in contact more approximately your post on AOL? I need an expert on this space to solve my problem. May be that is you! Looking forward to see you.

  16. Hiya, I’m really glad I’ve found this info. Today bloggers publish just about gossips and net and this is really frustrating. A good web site with exciting content, that’s what I need. Thank you for keeping this site, I’ll be visiting it. Do you do newsletters? Cant find it.

  17. Great info and right to the point. I am not sure if this is actually the best place to ask but do you guys have any ideea where to employ some professional writers? Thank you 🙂

  18. Valuable information. Lucky me I found your website by accident, and I am shocked why this accident didn’t happened earlier! I bookmarked it.

  19. Today, I went to the beach with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!

  20. There are some attention-grabbing points in time on this article however I don’t know if I see all of them middle to heart. There is some validity however I will take maintain opinion till I look into it further. Good article , thanks and we would like more! Added to FeedBurner as effectively

  21. Wonderful site you have here but I was wanting to know if you knew of any forums
    that cover the same topics discussed in this article?
    I’d really like to be a part of online community where I can get feedback from other experienced individuals that share the same interest.
    If you have any recommendations, please let me know.

    Thanks!

  22. It’s a pity you don’t have a donate button! I’d definitely donate to this fantastic blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to fresh updates and will share this site with my Facebook group. Talk soon!

  23. I was wondering if you ever thought of changing the page layout of your site?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect with it better.

    Youve got an awful lot of text for only having one
    or two pictures. Maybe you could space it out better?

  24. Hello, Neat post. There’s an issue with your website in web explorer, could check thisK IE nonetheless is the marketplace chief and a big part of people will leave out your excellent writing due to this problem.

  25. Very well written article. It will be useful to anybody who usess it, including yours truly :). Keep up the good work – can’r wait to read more posts.

  26. I am now not certain the place you’re getting your information, however good topic. I needs to spend some time learning much more or working out more. Thank you for magnificent info I used to be searching for this info for my mission.

  27. Hey there, I think your blog might be having browser compatibility issues.
    When I look at your blog site in Firefox, it looks fine but when opening in Internet
    Explorer, it has some overlapping. I just wanted to give you
    a quick heads up! Other then that, wonderful blog!

  28. Restylane乃一系列用於美顏的長效透明質酸產品。 Restylane療程能有效撫平皺紋、美化臉型輪廓及唇部,並可改善膚質及肌膚的彈性。Restylane透明質酸作用原理 Restylane透明質酸均以非動物來源的透明質酸作為原料,獨有的NASHA™專利技術研製而成。微量Restylane透明質酸凝膠到皮膚中,可以讓您的面部肌膚恢復豐盈飽滿。 Restylane透明質酸中的透明質酸與人體內的天然透明質酸十分相似,使用前無需進行皮膚測試,引起過敏反應的機率亦極低。

  29. A formidable share, I just given this onto a colleague who was doing a little analysis on this. And he the truth is bought me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the treat! However yeah Thnkx for spending the time to debate this, I feel strongly about it and love reading extra on this topic. If doable, as you develop into experience, would you thoughts updating your weblog with extra details? It is highly helpful for me. Big thumb up for this weblog post!

  30. Wonderful web site. Plenty of useful information here. I am sending it to several friends ans additionally sharing in delicious. And obviously, thanks in your sweat!

  31. Good – I should definitely pronounce, impressed with your web site. I had no trouble navigating through all tabs and related info ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or anything, website theme . a tones way for your client to communicate. Nice task.

  32. It’s the best time to make some plans for the longer term and it’s time to be happy. I’ve read this publish and if I could I want to suggest you some interesting issues or advice. Perhaps you can write subsequent articles relating to this article. I wish to read even more issues approximately it!

  33. Really superb information can be found on weblog. “The only thing you take with you when you’re gone is what you leave behind.” by John Allston.

  34. Thank you for some other wonderful post. The place else may just anybody get that type of information in such an ideal method of writing? I have a presentation subsequent week, and I’m at the search for such info.

  35. Thanks, I have recently been searching for info approximately this topic for a long time and yours is the greatest I’ve found out till now. However, what concerning the bottom line? Are you certain in regards to the source?

  36. I have been surfing online more than three hours lately, yet I never found any fascinating article like yours. It’s beautiful price enough for me. Personally, if all webmasters and bloggers made excellent content as you did, the net shall be a lot more helpful than ever before. “Dignity is not negotiable. Dignity is the honor of the family.” by Vartan Gregorian.

  37. Howdy would you mind sharing which blog platform you’re working with? I’m going to start my own blog soon but I’m having a hard time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I’m looking for something completely unique. P.S Apologies for getting off-topic but I had to ask!

  38. hi!,I love your writing so so much! share we communicate more about your post on AOL? I need an expert on this house to resolve my problem. Maybe that’s you! Taking a look ahead to peer you.

  39. I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz reply as I’m looking to construct my own blog and would like to find out where u got this from. thanks a lot

  40. I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz answer back as I’m looking to create my own blog and would like to find out where u got this from. thanks a lot

  41. I love your blog.. very nice colors & theme. Did you create this website yourself? Plz reply back as I’m looking to create my own blog and would like to know wheere u got this from. thanks

  42. An impressive share, I simply given this onto a colleague who was doing slightly evaluation on this. And he in fact purchased me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the deal with! However yeah Thnkx for spending the time to discuss this, I feel strongly about it and love studying more on this topic. If possible, as you change into experience, would you thoughts updating your blog with more particulars? It is extremely useful for me. Large thumb up for this weblog publish!

  43. Hello there, just became alert to your blog through Google, and found that it’s really informative. I am gonna watch out for brussels. I will be grateful if you continue this in future. Numerous people will be benefited from your writing. Cheers!

  44. Thanks for another informative web site. The place else may I am getting that type of info written in such an ideal way? I have a project that I’m simply now running on, and I have been on the glance out for such info.

  45. What i do not understood is actually how you are now not actually much more neatly-appreciated than you may be now. You are very intelligent. You already know thus significantly with regards to this subject, produced me personally imagine it from a lot of varied angles. Its like men and women are not interested unless it is one thing to accomplish with Woman gaga! Your personal stuffs outstanding. All the time deal with it up!

  46. I really like your writing style, superb information, appreciate it for putting up :D. “If a cluttered desk is the sign of a cluttered mind, what is the significance of a clean desk” by Laurence J. Peter.

  47. Thank you for sharing superb informations. Your web-site is very cool. I’m impressed by the details that you’ve on this blog. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for more articles. You, my friend, ROCK! I found just the info I already searched all over the place and just couldn’t come across. What a great website.

  48. What’s Happening i’m new to this, I stumbled upon this I have found It positively helpful and it has helped me out loads. I hope to contribute & help other users like its aided me. Great job.

  49. I not to mention my pals ended up reading through the best ideas on your site while quickly I had a terrible feeling I never thanked the web site owner for those strategies. The boys were definitely joyful to study them and now have without a doubt been taking advantage of those things. We appreciate you truly being indeed helpful and for choosing some wonderful useful guides most people are really desperate to be aware of. My sincere regret for not expressing gratitude to you earlier.

  50. Can I just say what a relief to find someone who truly knows what theyre talking about on the internet. You definitely know how to convey a difficulty to mild and make it important. More people need to learn this and perceive this side of the story. I cant believe youre not more common because you positively have the gift.

  51. Excellent beat ! I wish to apprentice while you amend your website, how can i subscribe for a blog website? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear concept

  52. Hey there! Someone in my Facebook group shared this website with us so I came to check it out. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers! Exceptional blog and fantastic style and design.

  53. You can certainly see your skills within the paintings you write. The sector hopes for even more passionate writers like you who are not afraid to mention how they believe. All the time go after your heart.

  54. A lot of thanks for your whole hard work on this site. Betty take interest in participating in research and it’s really obvious why. A lot of people notice all of the lively mode you convey both useful and interesting thoughts via the website and as well as attract participation from visitors on that content and our child is really being taught a great deal. Have fun with the rest of the new year. You are always performing a superb job.

  55. Howdy would you mind stating which blog platform you’re working with? I’m looking to start my own blog soon but I’m having a tough time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something unique. P.S My apologies for getting off-topic but I had to ask!

  56. I have been surfing online more than three hours as of late, but I never discovered any interesting article like yours. It¦s pretty value sufficient for me. In my view, if all webmasters and bloggers made good content material as you probably did, the net might be a lot more helpful than ever before.

  57. I discovered your blog web site on google and verify a couple of of your early posts. Proceed to keep up the very good operate. I just further up your RSS feed to my MSN News Reader. Looking for forward to reading extra from you afterward!…

  58. Magnificent beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog site? The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear concept

  59. Hello, Neat post. There is a problem along with your site in internet explorer, might test this… IE nonetheless is the marketplace chief and a big component to other folks will pass over your great writing because of this problem.

  60. I’m impressed, I have to say. Really not often do I encounter a blog that’s both educative and entertaining, and let me tell you, you have got hit the nail on the head. Your concept is excellent; the issue is something that not sufficient people are speaking intelligently about. I am very glad that I stumbled across this in my search for one thing referring to this.

  61. hi!,I love your writing so so much! share we keep in touch extra about your post on AOL? I require an expert in this area to unravel my problem. May be that’s you! Taking a look forward to look you.

  62. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You definitely know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something informative to read?

  63. I love your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to design my own blog and would like to know where u got this from. thanks

  64. I have been exploring for a little for any high-quality articles or blog posts on this sort of area . Exploring in Yahoo I at last stumbled upon this web site. Studying this information So i am glad to convey that I have an incredibly just right uncanny feeling I discovered just what I needed. I so much certainly will make certain to do not disregard this site and provides it a look on a continuing basis.

  65. I have been absent for a while, but now I remember why I used to love this web site. Thank you, I’ll try and check back more frequently. How frequently you update your web site?

  66. I think this is among the most vital info for me. And i’m glad reading your article. But want to remark on few general things, The web site style is ideal, the articles is really nice : D. Good job, cheers

  67. My husband and i felt quite peaceful when Albert managed to round up his investigations through the entire ideas he acquired in your web pages. It is now and again perplexing to simply happen to be handing out methods which usually some others could have been selling. So we do understand we now have the website owner to thank for this. The entire illustrations you’ve made, the straightforward blog navigation, the relationships you can help create – it’s got many remarkable, and it’s facilitating our son and us imagine that this issue is satisfying, which is certainly extraordinarily essential. Thank you for all the pieces!

  68. We are a group of volunteers and opening a new scheme in our community. Your web site provided us with valuable information to work on. You’ve done a formidable job and our entire community will be grateful to you.

  69. Thank you for any other fantastic article. Where else may anyone get that kind of information in such a perfect manner of writing? I’ve a presentation next week, and I am on the look for such information.

  70. Thanks for the sensible critique. Me & my neighbor were just preparing to do some research on this. We got a grab a book from our local library but I think I learned more from this post. I’m very glad to see such excellent info being shared freely out there.

  71. My spouse and I stumbled over here by a different page and thought I might as well check things out. I like what I see so now i am following you. Look forward to going over your web page for a second time.

  72. I love your blog.. very nice colors & theme. Did you create this website yourself? Plz reply back as I’m looking to create my own blog and would like to know wheere u got this from. thanks

  73. With havin so much content do you ever run into any problems of plagorism or copyright infringement? My website has a lot of exclusive content I’ve either authored myself or outsourced but it seems a lot of it is popping it up all over the web without my permission. Do you know any solutions to help stop content from being ripped off? I’d truly appreciate it.

  74. Hiya, I am really glad I’ve found this info. Nowadays bloggers publish just about gossips and web and this is actually frustrating. A good website with interesting content, that is what I need. Thank you for keeping this website, I will be visiting it. Do you do newsletters? Cant find it.

  75. I do trust all of the ideas you’ve presented in your post. They’re very convincing and can certainly work. Nonetheless, the posts are too short for novices. Could you please prolong them a bit from subsequent time? Thank you for the post.

  76. Hello there! I know this is kinda off topic however , I’d figured I’d ask. Would you be interested in exchanging links or maybe guest writing a blog post or vice-versa? My blog discusses a lot of the same subjects as yours and I think we could greatly benefit from each other. If you are interested feel free to shoot me an email. I look forward to hearing from you! Excellent blog by the way!

  77. Very good blog! Do you have any helpful hints for aspiring writers? I’m hoping to start my own website soon but I’m a little lost on everything. Would you suggest starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m totally overwhelmed .. Any tips? Thanks!

  78. I’ve been exploring for a little bit for any high-quality articles or blog posts in this sort of house . Exploring in Yahoo I eventually stumbled upon this web site. Studying this info So i’m satisfied to convey that I’ve an incredibly just right uncanny feeling I found out just what I needed. I such a lot undoubtedly will make certain to don’t forget this site and give it a glance regularly.

  79. My wife and i ended up being quite lucky when Chris managed to complete his investigations through the entire precious recommendations he came across from your very own web page. It’s not at all simplistic just to always be giving out tips that many some other people could have been selling. So we fully grasp we have got the website owner to give thanks to for this. These illustrations you made, the easy blog menu, the relationships your site make it easier to create – it’s got mostly spectacular, and it is letting our son and our family imagine that that concept is cool, and that is wonderfully fundamental. Many thanks for the whole lot!

  80. I am no longer positive the place you’re getting your info, however good topic. I needs to spend some time learning much more or working out more. Thank you for excellent information I used to be searching for this info for my mission.

  81. Excellent site you have here but I was wondering if you knew of any discussion boards that cover the same topics discussed here? I’d really like to be a part of group where I can get comments from other knowledgeable people that share the same interest. If you have any suggestions, please let me know. Kudos!

  82. Hello! This is my first comment here so I just wanted to give a quick shout out and say I truly enjoy reading through your blog posts. Can you suggest any other blogs/websites/forums that cover the same subjects? Thank you so much!

  83. My partner and I stumbled over here different website and thought I might as well check things out. I like what I see so now i am following you. Look forward to going over your web page for a second time.

  84. A powerful share, I just given this onto a colleague who was doing somewhat evaluation on this. And he in truth purchased me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to debate this, I feel strongly about it and love studying more on this topic. If potential, as you turn into experience, would you thoughts updating your weblog with extra particulars? It is extremely helpful for me. Large thumb up for this blog post!

  85. I am now not sure where you’re getting your information, however great topic. I must spend some time studying much more or understanding more. Thanks for wonderful info I used to be searching for this information for my mission.

  86. Good V I should certainly pronounce, impressed with your web site. I had no trouble navigating through all the tabs and related information ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or something, site theme . a tones way for your customer to communicate. Nice task..

  87. Thank you for your whole effort on this web site. Gloria enjoys going through internet research and it’s really easy to see why. All of us hear all of the lively form you render both useful and interesting thoughts via this website and as well as improve contribution from other individuals on this area while my daughter is certainly discovering a great deal. Enjoy the rest of the new year. You’re conducting a glorious job.

  88. Excellent pieces. Keep writing such kind of information on your page.
    Im really impressed by your site.
    Hey there, You have performed an excellent job. I’ll definitely digg
    it and individually suggest to my friends. I’m confident they’ll be
    benefited from this site.

  89. Yesterday, while I was at work, my sister stole my iPad and tested to see if it can survive a thirty foot drop, just so she can be a youtube sensation. My iPad is now broken and she has 83 views.
    I know this is entirely off topic but I had to share it with someone!

  90. Thanks for another informative site. The place else may just I am getting that kind of information written in such an ideal way?
    I have a project that I am simply now operating on, and I
    have been at the glance out for such information.

  91. Heya! I understand this is somewhat off-topic however I
    had to ask. Does building a well-established website such as yours require a massive amount work?

    I’m brand new to operating a blog but I do write in my journal everyday.
    I’d like to start a blog so I can share my experience and feelings online.
    Please let me know if you have any suggestions or tips for new aspiring blog owners.
    Thankyou!

  92. An individual basically help to make fundamentally posts I’d state. That is the absolute first time I frequented your website page and up to now? I shocked with the investigation you made to influence this real to distribute mind blowing.