CGFCBCV
CGFCBCV
2. Given the initial deposit, the annual interest rate, and the number of years that
you invest your money in an investment account. Calculate the final amount of
the investment using math.pow() function.
3. Write a program to find root of the equation 4x2 -21x + 25=0 using the formula
4. Write a program to take “gender” as input from user. If the user is male, give the
message: Good Morning Sir. If the user is female, give the message: Good
Morning Ma’am.
5. Write a program to take input color of road traffic signal from the user & show
the message according to this table:
SIGNAL COLOR MESSAGE
RED Vehicle must stop
Vehicles should get ready
YELLOW
to move
GREEN Vehicles can move now
6. Write a program that takes user input day name. If the day is Monday, Tuesday,
Wednesday, Thursday or Friday, then show “It’s a week day”. If the day is
Saturday then show “It’s weekend”. If the day is Sunday then show “Yay! It’s a
holiday”.
7. Use a conditional (ternary) operator for this exercise:
If the variable age is a value below 18, the value of the variable voteable should be
"Too young", otherwise the value of voteable should be "Old enough".
8. Write a program to take input the marks obtained in three subjects & total marks.
Compute & show the resulting percentage on your page. Take percentage &
compute grade as per following table:
Percentage Grade Remarks
Greater than or equal to
A-one Excellent
80
Greater than or equal to
A Good
70
Greater than or equal to
B You need to improve
60
Less than 60 Fail Sorry
Show the total marks, marks obtained, percentage, grade & remarks like:
Marks Sheet
Total Marks: 300
Marks Obtained: 219
Percentage: 73%
Grade: B
Remarks: You need to improve
9. Write a program to repeatedly print the value of the variable num which is input
by user. Value should be decreasing by 0.5 each time, as long as x Value remains
positive.
Enter a number: 5
5, 4.5, 4, 3.5, 3, 2.5, 2, 1.5, 1, 0.5, 0
10. Write a program using for loop that will iterate from 1 to 20. For each iteration, it
will check if the current number is even or odd, and report that to the screen (e.g.
"2 is even").
1 is Odd
2 is Even
3 is Odd
4 is Even
5 is Odd
and so on.