Skip to content · ⁨דלג לתוכן⁩

Positive, negative or zero · ⁨חיובי, שלילי או אפס⁩

English

Positive, negative or zero

n is -4. Print positive, negative or zero — whichever n is.

Three answers need if, then elif, then else. Python tries them in order and stops at the first one that is true, so the else only runs when both questions above it said no.

עברית

חיובי, שלילי או אפס

n הוא -4. הדפס positive, negative או zero — כל אחד שהn הוא.

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

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP