You are on page 1of 2

COMSATS University Islamabad, Lahore Campus

Department of Electrical and Computer Engineering

Assignment 3– SPRING 2024


Course Title: AICT Course Code: CSC-101 Credit Hours: 3(2,1)
Course Instructor: Syed Ahmed Faran Programme Name: BEE
Semester: 2nd FA23 Section: B Date:
th
Submission Date: Tuesday, 14 May, 2024 Maximum Marks: 40
Name: Registration Number:
Important Instructions / Guidelines:
 You have to write the code on Google Colab and paste below a clear snapshot of your code and the
output.
 Submit the assignment within due time, before the scheduled class, on CUONLINE.
 In case of plagiarism, you will be marked ZERO.

Problem 1: [CLO2-PLO2-C3][20
Marks]

For the quadratic equation a x 2 +bx +c=0 , the roots are found using the formula (where a ≠ 0):
−b ± √ b2−4 ac
x=
2a

The term b 2−4 ac is called the discriminant.


The equation has 2 equal roots if: discriminant is equal to 0.
The equation has 2 real roots if: discriminant is greater than 0.
The equation has 2 complex roots if: discriminant is less than 0.

Write a Python script that prompts user to enter the coefficceints (a ,b ,c ) and show the roots of x and print if the
roots are real or imaginary and equal or distinct.

(note: do not find the roots if the roots are complex, instead only print out that the roots are complex.)

Page 1 of 2
Problem 2: [CLO2-PLO2-C3][20 Marks]

Write a Python script that takes three inputs from user and returns the largest number out of the three. Write a
function to calculate the largest number. Write another function by the name of ‘main()’ that calls the earlier
function to calculate the largest number.

Page 2 of 2

You might also like