Positive, negative or zero · חיובי, שלילי או אפס
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 תועבד רק כאשר שתי השאלות מעליה אמרו 'לא'.
n is -4. Print positive, negative or zero — whichever n is. · n הוא -4. הדפס positive, negative או zero — כל אחד שהn הוא.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.