top of page

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

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

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

אפשר לראות שהתוצאה של השורש הריבועי של 16 היא 4.0 ולא סתם 4 וזה קשור לסוג הערך שאנו מקבלים לאחר הוצאת שורש- מספרים שלמים הם ערכים מסוג integer, ומספרים עשרוניים (0.25 למשל) הם ערכים מסוג float. בפייתון גם מספרים שלמים יכולים לקבל ייצוג כמספרים עשרוניים (שהם ערכים מסוג float), למשל 2.0. בפייתון כאשר מבצעים פעולת שורש או חילוק, באופן אוטומטי מתקבל ערך עשרוני מסוג float, גם אם תוצאת החילוק או השורש היא מספר שלם. ולכן אנו מקבלים 4.0 שהוא ערך מסוג float.

למדנו עד כה כי ערכים יכולים להיות מסוג string , integer או float - דוגמאות -


String integer float

"two" 0 3.0

'd"d' 223 0.0

'123' -10 1.234


 
 
 

Related Posts

See All
משתנים

משתנים כמו בכל תוכנית אנו יכולים לקבוע שרצף מסוים של אותיות ומספרים יהיה משתנה (ולא סתם מחרוזת טקסט). על מנת לסמן אות או רצף סימנים...

 
 
 

1 comentario


Miranda Winters
Miranda Winters
3 days ago

Hello! I found the perfect cordless impact driver at www.ukplanettools.co.uk/cordless-power-tools/cordless-impact-driver/l/manufacturer:makita/. The power and precision of this tool make it stand out from others I’ve tried. It’s compact, easy to handle, and delivers excellent torque. The cordless feature lets me work anywhere without fuss. UK Planet Tools also provided fast delivery and excellent service.

Me gusta
Single Post: Blog_Single_Post_Widget
bottom of page