13.Programming Assignment 3 ( Programs using if-else)

Try the following program using if else or if elif statement
1)Compare two numbers
2)Check whether the given number is even or odd.
3)Find the biggest of 3 numbers
4)Read internal marks( out of 50) and external mark( out of 100) and print passed /failed in internal or external ( use KTU criteria..45%)
5)Check whether the given number is zero, positive or negative.
6)Find the roots of a quadratic equation ( ax^2+bx+c)
7)Read length of 3 sides and check whether it forms a triangle.
(All you have to do is use the Triangle Inequality Theorem, which states that the sum of two side lengths of a triangle is always greater than the third side. If this is true for all three combinations of added side lengths, then you will have a triangle.)
8)Check the type of a triangle after reading the three sides ( scalene, isosceles, equilateral)
9) Check the type of a triangle after reading the three vertices ( scalene, isosceles, equilateral)
Note:
From the vertices length of the sides can be computed using the distance formulae.
A scalene triangle is a triangle that has three unequal sides.
An isosceles has two equal sides and two equal angles.
An equilateral triangle is a triangle with all three sides of equal length and also has three equal 60 degree angles.
10) Read a mark ( out of 100) and print the corresponding grade.
Percentage Range Grade
>=90 O
>=85 and <90 A+
>= 80 and <85 A
> =70 and <80 B+
> =60 and <70 B
> =50 and <60 C
>=45 and <50 P
<45 F
11) answer = input("Do you like Python? ")
if the answer is "yes" print "That is great!" else print "That is disappointing!".If the user input something else print “Enter yes/no”
12)Check whether a given year is Leap Year or not. A year is leap year if following conditions are satisfied
1) Year is multiple of 400
2) Year is multiple of 4 and not multiple of 100.
13)Write a program to check the quadrant of a given point(x,y)( University question)
14)Write a program to get the absolute value of a number without using the abs() function.(university question)
15)Write a program that accepts the length of three sides of a triangle as input and determine whether or not the triangle is a right triangle.( university question)
16)Given three points (x1,y1 ) ,(x2,y2) and (x3,y3), check whether they form a triangle.

Comments

Popular posts from this blog

Python For Machine Learning - CST 283 - KTU Minor Notes- Dr Binu V P

46.Classes and Objects in Python- Accessors and mutators

KTU Python for machine learning Sample Question Paper and Answer Key Dec 2020