top of page

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

שווה (=) ושווה יותר (==)

שווה (=) ושווה יותר (==)

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


x=5

if x<2:

print ("small")

if x==5:

print ("equal") >>> equal

כדי לבדוק אם אגף ימין של משוואה (במקרה למעלה 5) שווה לאגף שמאל (במקרה למעלה x) נעשה שימוש בשווה כפול (==) וכדי להציב ערכים במשתנים נשתמש בשווה בודד (=).

 
 
 

Related Posts

See All
מערכת תנאים - הפקודות if, elif, else

מערכת תנאים - הפקודות if, elif, else לעיתים אנו רוצים לייצר מבנה המורכב משרשרת של תנאים שאם אחד מהם מתקיים המחשב מפסיק את תהליך הבדיקה...

 
 
 

1 comentário


Sahil Khan
Sahil Khan
25 de jan.

When it comes to trading metals, selecting the right platform is essential for both experienced traders and beginners. Among the top contenders in the market, Winprofx stands out as one of the best metals trading platforms, offering a user-friendly interface, advanced trading tools, and reliable market analysis. Whether you're interested in trading precious metals like gold and silver or base metals such as copper and aluminum, Winprofx provides seamless access to a broad range of metal markets. The platform’s real-time market data, customizable charts, and automated trading features help traders make informed decisions and execute strategies with precision. With competitive spreads and low fees, Winprofx ensures that every trade is cost-effective, while also delivering security and transparency, making it a…


Curtir
Single Post: Blog_Single_Post_Widget
bottom of page