Ana sayfa Programlama Pythonda Operatörler

Pythonda Operatörler

3024
90
PAYLAŞ

Matematik Operatörleri

Tekrardan hoşgeldiniz.

Python’da ve diğer programlama dillerinde matematik operatörleri oldukça önemlidir. Bu konumuzda, Pythondaki matematik operatörlerini öğreneceğiz.

Toplama İşlemi (+)

Python’da toplama işlemi şu şekilde yapılabilmektedir.

Çıktı: 29

Çıktı: 7.9

Çıkarma İşlemi (-)

Python’da çıkarma işlemi şu şekilde yapılabilmektedir.


Çıktı: -47

Çıktı: -6

Çıktı: -2.6999999999999997

Çarpma İşlemi (*)

Python’da çarpma işlemi şu şekilde yapılabilmektedir.

Çıktı: 20

Çıktı: 14.13

Çıktı : 60

Çıktı: 9.42

Bölme İşlemi (/)

Python’da bölme işlemi şu şekilde yapılabilmektedir.

Çıktı: 2.0

Çıktı: 3.333333333335

Çıktı: 3.142857142857143

Şimdi, burada matematikten farklı olarak bir şey gerçekleşti. “4 / 2” işleminin sonucunun “2” olarak çıkması gerekirken, sonuç “2.0” olarak, yani ondalıklı olarak(float) çıktı. Bu özellik, Python 3’e işlem sonucunun daha kesin bir şekilde sağlanması için konulmuş bir özellik. Bunları ilerde çok daha iyi bir şekilde anlayacağız.

Peki bir sayının başka bir sayıya bölümünden çıkan bölüm sonucunu nasıl bulacağız ? Bunun için de Python3’te şu şekilde bir operatör mevcut.

Tamsayı Bölmesi (//)

Bu operatör, bir sayının başka bir sayıya bölümünden ortaya çıkan bölüm sonucunu vermektedir.Örneklerimize bakalım.

Çıktı: 2

Çıktı: 3

Kalanı Bulma (%)

Bu operatör de , bir sayının başka bir sayıya bölümünden kalan sonucunu bulmamızı sağlar.

Çıktı: 1

Üs bulma (**)

Bu operatör bir sayının üssünü bulmamızı sağlar. Örnek olarak operatörün solundaki sayının sağdaki sayıya göre üssünü ekrana basar.


Çıktı: 64

Peki bir sayının karekökünü nasıl bulacağız ? Matematikten bildiğimiz gibi, bir sayının karekökü , o sayının 1/2 (0.5). üssüdür. O zaman örneğimizle 64 sayısının karekökünü bulmaya çalışalım.

Çıktı: 8.0

Operatörleri beraber kullanma ve İşlem sırası

Bütün bu öğrendiğimiz şeyleri beraber nasıl kullanabiliriz? Bunun için matematikteki işlem sırasını biliyorsak çok rahat edeceğiz, çünkü Pythondaki işlem sırası matematiktekiyle birebir aynıdır. Nedir bu işlem sırası ? Kurallar şunlar ;

  • 1. Parantez içi her zaman önce yapılır.
  •  Çarpma ve Bölme her zaman Toplama ve Çıkarma işlemine göre önce yapılır.
  • İşlemler soldan sağa değerlendirilir.

Ancak, buradaki işlemleri ezberlememize hiç gerek yok. Kafamızın karıştığı yerler de işlemleri parantez içine almak, hayat kurtarır 🙂 Şimdi örneklere bakalım.

Çıktı: -4.0

Çıktı: -4.0

İşte matematik operatörleri tamamıyla bu şekilde !

Bir diğer yazımızda Karakter Dizilerini (string) öğreneceğiz.

90 YORUMLAR

  1. I’m often to running a blog and i actually admire your content. The article has actually peaks my interest. I am going to bookmark your site and preserve checking for brand new information.

  2. Hi! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data backup. Do you have any methods to prevent hackers?

  3. Greetings! I know this is kinda off topic but I was wondering if you knew where
    I could find a captcha plugin for my comment form?
    I’m using the same blog platform as yours and
    I’m having trouble finding one? Thanks a lot!

  4. Good website! I truly love how it is simple on my eyes and the data are well written. I am wondering how I might be notified whenever a new post has been made. I’ve subscribed to your RSS which must do the trick! Have a nice day!

  5. I’ve been exploring for a little for any high-quality articles or weblog posts in this kind of area . Exploring in Yahoo I finally stumbled upon this site. Studying this information So i am happy to exhibit that I’ve an incredibly just right uncanny feeling I came upon exactly what I needed. I so much no doubt will make certain to do not omit this web site and provides it a glance regularly.

  6. After I originally commented I seem to have clicked on the -Notify me when new comments are added- checkbox and now whenever a comment
    is added I get four emails with the exact same comment.
    Perhaps there is an easy method you are able to remove
    me from that service? Cheers!

  7. I’m extremely inspired together with your writing skills as neatly as with the structure to your blog. Is that this a paid theme or did you modify it your self? Anyway stay up the nice quality writing, it’s rare to peer a great blog like this one nowadays..

  8. Wonderful 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

  9. F*ckin¦ tremendous issues here. I am very happy to look your post. Thank you a lot and i’m looking forward to contact you. Will you please drop me a mail?

  10. Woah! I’m really enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very difficult to get that “perfect balance” between user friendliness and appearance. I must say you have done a excellent job with this. Also, the blog loads very fast for me on Opera. Superb Blog!

  11. Excellent weblog here! Additionally your website loads up fast! What host are you using? Can I am getting your affiliate hyperlink to your host? I desire my site loaded up as quickly as yours lol

  12. I really enjoy reading through on this internet site, it holds wonderful blog posts. “The living is a species of the dead and not a very attractive one.” by Friedrich Wilhelm Nietzsche.

  13. I have learn a few good stuff here. Definitely value bookmarking for revisiting. I surprise how a lot effort you place to make the sort of magnificent informative website.

  14. Amazing blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog jump out. Please let me know where you got your design. Thanks a lot

  15. This design is incredible! You definitely know how to keep
    a reader amused. Between your wit and your videos, I was almost moved to start
    my own blog (well, almost…HaHa!) Excellent job.
    I really enjoyed what you had to say, and
    more than that, how you presented it. Too cool!

  16. Fantastic beat ! I would like to apprentice even as you amend your website, how can i subscribe for a blog web site? The account aided me a applicable deal. I have been a little bit familiar of this your broadcast provided brilliant clear concept

  17. I’m so happy to read this. This is the type of manual that needs to be given and not the random misinformation that’s at the other blogs. Appreciate your sharing this greatest doc.

  18. Hey, I think your site might be having browser compatibility issues. When I look at your blog 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, superb blog!

  19. Nice weblog right here! Additionally your site loads up very fast! What web host are you using? Can I get your affiliate link for your host? I want my web site loaded up as fast as yours lol

  20. Hey just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Opera. I’m not sure if this is a format issue or something to do with web browser compatibility but I thought I’d post to let you know. The design and style look great though! Hope you get the problem fixed soon. Cheers

  21. When I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks!

  22. I’m impressed, I must say. Actually not often do I encounter a blog that’s each educative and entertaining, and let me inform you, you’ve hit the nail on the head. Your idea is outstanding; the difficulty is one thing that not sufficient individuals are talking intelligently about. I am very pleased that I stumbled throughout this in my search for something referring to this.

  23. Hi there very nice site!! Guy .. Excellent .. Wonderful .. I will bookmark your web site and take the feeds also?KI am satisfied to search out so many helpful info here within the post, we want develop more techniques on this regard, thank you for sharing. . . . . .

  24. 通過水光療程抑制黑色素細胞生長的成分注射到真皮層,減少黑色素形成,淡化黑斑色素沉澱,從而達到美白祛斑的效果 療程特色 :可配搭多元化產品來量身訂做不同療​​程計算機化規格,操作方便,容易控制可調節進針深度,精準注射於目標的肌膚層 每針的注射劑量相等,達到均勻注射 一次平均5點注射,可縮短療程時間 採用31號細針頭,幾乎看不到入針點 降低疼痛、瘀血、腫脹及不適感 使用靈活度高,可複合式搭配針劑,量身訂製療程

  25. Hi there! This post couldn’t be written any better! Reading through this post reminds me of my previous room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thank you for sharing!

  26. Howdy, simply become mindful of your own web site by way of Yahoo and google, determined that must be seriously educational.. koleksi vlogger terbaik I’m just usually watchful with regard to belgium’s capital. I’m going to love for individuals who carry on this later on. Many people is usually benefited from the creating. Regards!

  27. Fantastic goods from you, man. I’ve understand your stuff previous to and you’re just too fantastic. I really like what you’ve acquired here, certainly like what you are stating and the way in which you say it. You make it enjoyable and you still care for to keep it wise. I cant wait to read much more from you. This is actually a wonderful web site.

  28. What i don’t realize is in truth how you are no longer actually a lot more smartly-preferred than you may be right now. You are so intelligent. You understand therefore considerably in terms of this topic, made me for my part consider it from numerous numerous angles. Its like women and men don’t seem to be fascinated except it is something to do with Woman gaga! Your personal stuffs excellent. Always maintain it up!

  29. Howdy just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Chrome. I’m not sure if this is a format issue or something to do with internet browser compatibility but I thought I’d post to let you know. The layout look great though! Hope you get the issue fixed soon. Kudos

  30. Hi my loved one! I want to say that this article is amazing, great written and
    include almost all important infos. I would like to peer extra posts like this .

  31. hello there and thanks to your info – I have certainly picked up something new from right here. I did alternatively experience several technical points using this web site, since I experienced to reload the web site a lot of times prior to I could get it to load correctly. I were brooding about if your hosting is OK? Now not that I’m complaining, but sluggish loading cases instances will sometimes have an effect on your placement in google and could harm your high quality rating if ads and ***********|advertising|advertising|advertising and *********** with Adwords. Anyway I’m including this RSS to my e-mail and could glance out for a lot more of your respective exciting content. Ensure that you replace this again soon..

  32. I like the helpful information you supply for your articles. I’ll bookmark your weblog and take a look at once more right here frequently. I’m rather sure I will be told many new stuff proper here! Best of luck for the following!

  33. of course as if your internet site however you need to check out the spelling upon a number of you. A few of options rife by using punctuation challenges so i to uncover them incredibly problematic to express to the fact on the other hand I am going to unquestionably give back all over again.. apa itu trading saham

  34. Hiya! I know this is kinda off topic nevertheless I’d figured I’d ask. Would you be interested in exchanging links or maybe guest writing a blog article or vice-versa? My website discusses a lot of the same subjects as yours and I believe we could greatly benefit from each other. If you might be interested feel free to shoot me an email. I look forward to hearing from you! Awesome blog by the way!

  35. I do agree with all the ideas you have introduced on your post. They’re very convincing and can definitely work. Still, the posts are very quick for beginners. May you please lengthen them a little from next time? Thanks for the post.

BİR CEVAP BIRAK

Lütfen yorumunuzu giriniz
Buraya isminizi giriniz