logo

Crowdly

Browser

Add to Chrome

PROGRAMMING 511(2025S1PR511AD)

Looking for PROGRAMMING 511(2025S1PR511AD) test answers and solutions? Browse our comprehensive collection of verified answers for PROGRAMMING 511(2025S1PR511AD) at learning.richfield.ac.za.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

3.2 Write a complete program that reads a list of student names and marks from a text file called students.txt. Each line of the file contains a name and a mark separated by a comma. The program should:

  • Open the file for reading.
  • Read each line and split it into name and mark.
  • Convert the mark to an integer.
  • Determine whether the student has passed (mark ≥ 50).
  • Print the result for each student.
  • Handle file not found and data conversion errors using exception handling. [25 Marks]
View this question

3.1 You are tasked with creating a student grade management system. Ask the user to enter the student ID, Name, Assignment Score, Midterm Score, and Final Exam Score. The program should contain the following functions:

a. calculateWeightedScore Weighted Score = (Assignment Score * 0.3) + (Midterm Score * 0.3) + (Final Exam Score * 0.4)

b. displayStudentRecord displays all the student details, including ID, Name, Assignment Score, Midterm Score, Final Exam Score, Weighted Score, Grade Letter, and GPA.(25 Marks)

View this question

2.2 Write a Python function to evaluate whether a number is "Perfect" or not. A perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself (also known as its aliquot sum). Equivalently, a perfect number is a number that is half the sum of all its positive divisors (including itself).

Example

The first perfect number is 6, because 1, 2, and 3 are its proper positive divisors, and 1 + 2 + 3 = 6. Equivalently, the number 6 is equal to half the sum of all its positive divisors: (1 + 2 + 3 + 6) / 2 = 6. The next perfect number is 28 = 1 + 2 + 4 + 7 + 14. This is followed by the perfect numbers 496 and 8128.(15 Marks)

View this question

2. 1 Write a program that asks the user the number of integers they wish to enter. Find and print the sum of the even and odd integers. (15 Marks)

View this question

1.2 Explain the purpose of assignment operators in Python. In your explanation discuss any four types and include examples of these types to demonstrate their usage.(5 marks)

View this question

1.3 Discuss the concept of Boolean logic in Python. In your explanation discuss the logical operators (and, or, not) and their usage by means of examples.(5 marks)

View this question

1.4 What is operator precedence? What are the rules that determine operator precedence in Python? (5 Marks)

View this question

1.1 List the 4 rules used to name variables.(5 marks)

View this question

Question Four [25 Marks]

Write a program that uses a while loop to create a count-controlled loop which prints the squares of numbers from 1 to 10. Then, explain the difference between a count-controlled loop and an event-controlled loop, providing an example of when each would be most appropriate.

View this question

Question Three [25 Marks]

Write a program that calculates the monthly subscription fee for a streaming service based on the package type and number of devices. If the package is "basic", charge R49.90 for 1 device, R89.90 for 2-3 devices, and R150.90 for 4-6 devices. If the package is "premium", charge R129.90 for 1 device, R169.90 for 2-3 devices, and R209.90 for 4-6 devices. Calculate and display the final monthly subscription cost with a detailed breakdown of the base price and any add-on charges.

View this question

Want instant access to all verified answers on learning.richfield.ac.za?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome