Check if a Number is Positive or Negative
Write a Python program using an if-else decision structure to verify whether a given integer is positive or negative.
Questions on top, code solution screenshots directly below. Click any image to expand.
Write a Python program using an if-else decision structure to verify whether a given integer is positive or negative.
Write a Python program to read marks for 5 subjects and determine if a student passes or fails based on passing criteria in all subjects.
Write a Python program using if-else to determine whether a given integer is a Buzz number (divisible by 7 or ending with 7).
Write a Python program to verify if an input integer contains exactly 5 digits; if true, extract and display its central third digit, otherwise display an invalid length notice.
Write a Python program to input three side lengths and use the triangle inequality theorem in an if-else check to determine if they form a valid triangle.
Program to calculate roots of a quadratic equation if the value of x=b2-4ac is less than 0 the roots are imaginary
Write a Python program to calculate purchasing amount find discount,net bill based on given condition if purchase amount >=5000 discount 40% otherwise discount 20%.
Write a Python program using if-else to determine whether an input calendar year is a leap year according to gregorian leap year rules.
Write a Python program to read student percentage or marks and print 'Pass' if the marks meet or exceed the cutoff (e.g. 33%), otherwise print 'Fail'.
Write a Python program to input Cost Price (CP) and Selling Price (SP), and use an if-else decision to determine whether a transaction made profit or loss, displaying the exact amount.
Write a Python program to input three numbers and verify whether they are equal or different using an if-else statement.
Write a Python program to take an alphabet character as input and use if-else to determine whether it is a vowel or a consonant.
Write a Python program to input three numbers and use if-else conditions to verify whether all three values are completely distinct or if duplicates exist.