top of page

רעננו את הדף והקליקו למעבר לנושא הבא:

פעולות מתמטיות בסיסיות

פעולות מתמטיות בסיסיות

בפייתון, כאמור, די פשוט לבצע פעולות מתמטיות בסיסיות. למען האמת גם פעולות מתמטיות מורכבות זה די קל לבצע משום שהשפה תומכת בכך לחלוטין -


חיבור

print (2+3)

>>>

5

חיסור

print (5-3)

>>>

2

כפל

print (2*3)

>>>

6

חילוק

print (6/3)

>>>

2

חזקה

print (2**3)

>>>

8


אנו רואים שכפל מסומן בכוכבית (*) וחילוק בסלש (/) כמו כן סדר פעולות חשבון עובד כרגיל כמו בשיעורי חשבון בבית הספר (כפל וחילוק לפני חיבור וחיסור, קודם מבצעים פעולות בתוך סוגריים וכו').

לגבי פעולת השורש הדבר מעט יותר מורכב אולם בשלב זה נסתפק בכך ששורש ריבועי ניתן לייצג כחזקה של 1/2 כלומר שורש ריבועי של 4 הוא 4 בחזקת 1/2 ולכן -


שורש ריבועי

print (16**0.5)

>>>

4.0

אפשר גם

print (16**(1/2))

>>>

4.0


 
 
 

Related Posts

See All
סוגי מספרים -  integer או float

סוגי מספרים - integer או float אפשר לראות שהתוצאה של השורש הריבועי של 16 היא 4.0 ולא סתם 4 וזה קשור לסוג הערך שאנו מקבלים לאחר הוצאת...

 
 
 

1 Comment


yovax61269
Jun 11, 2024

Getting to know everyone better is like a cup of coffee in the morning, a ritual that everyone cannot do without. That is why I am very happy that I can easily read the news here https://osvitatlm.if.ua/en and be sure that it will be verified and up-to-date. They have recently published a very cool article about the acquisition of the Parus skyscraper by a well-known businessman and investor Maxim Krippa, which was a very important event in the real estate world. It's very cool that Maxim is entering a new investment sector for himself, and I think it's the right decision because you need to diversify your investments. In general, Krippa refers to the new investors who will be the…

Like
Single Post: Blog_Single_Post_Widget
bottom of page