Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PC7.1-PC7.5 One individual practical assignment including threetasks Task 1: Write/complete a Python program to solve a problem using if and if-else block structures Create an

PC7.1-PC7.5 One individual practical assignment including threetasks

Task 1: Write/complete a Python program to solve a problem using if and if-else block structures

Create an if statement that will check if the marks variable is greater than or equal to 60. If true, create a print statement that will output Pass and print Fail if condition fails

Test conditions with different values for marks

Answer:

Task 2: Determine the output for the following code

 
if (n > 10):
 print("*****")
if (n > 7):
 print("****")
if (n > 4):
 print("***")
if (n > 1):

print("**")

How many *will be printed when the code is executed in the following cases:

a) with n = 6?

b) with n = 1?

Answer:

Task 3: Writea python program that uses a multi-way selection if-elif-else statement toprint the letter grade of a student according to his numeric mark and display it as per the table given below.

Condition

Printed output

Mark between 90 and 100

Grade A

Mark between 80 and 89

Grade B

Mark between 70 and 79

Grade C

Mark between 60 and 69

Grade D

Mark less than 60

Fail

Mark more than 100 or negative

INVALID MARK

Answer:

Task 4: Use nested if statements to implement the task below:

If i is less than 20 then perform the following:

  • If i is less than 15 then display i is smaller than 15
  • If i is less than 12 then display i is smaller than 12 too
  • Otherwise, display i is greater than 12

Answer:

print(i ,is smaller than 15)

can you please answer correctly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions