Assignment 2-A

Data Types & String Mastery

Put your data types and string skills to the test! Build a Student Grade Management System that uses type conversions, numeric operations, string formatting, and text manipulation to create comprehensive student reports.

3-4 hours
Intermediate
150 Points
Submit Assignment
What You'll Practice
  • Work with all Python data types
  • Master type conversions and casting
  • Apply arithmetic and comparison operators
  • Use string methods and manipulation
  • Create formatted output with f-strings
Contents
01

Assignment Overview

In this assignment, you will build a Student Grade Management System - a Python program that processes student data, calculates grades, and generates formatted reports. This project will test your mastery of Module 2 concepts: data types, type conversions, operators, and string manipulation.

Building on Module 1: This assignment assumes you are comfortable with variables, input/output, and basic Python syntax from Module 1. You will now take your skills further by working with different data types and mastering string operations!
Skills Applied: This assignment tests your understanding of Data Types Deep Dive (2.1), Operators (2.2), and String Manipulation (2.3) from Module 2.
Data Types (2.1)

Working with int, float, str, bool and mastering type conversions

Operators (2.2)

Arithmetic, comparison, logical, and assignment operators for calculations

Strings (2.3)

String methods, slicing, formatting, and text manipulation

Ready to submit? Already completed the assignment? Submit your work now!
Submit Now
02

The Scenario

Student Grade Management System

You have been hired by a local coaching center called "BrightMind Academy" to create a Python program that helps teachers manage student grades. The center director explains their requirements:

"We need a system that takes student information and test scores, calculates grades, and generates neat, formatted report cards. It should handle different data types properly - student IDs are text, scores are numbers, and we need yes/no for pass status. The reports should look professional with proper alignment and formatting!"

Your Task

Create a Python file called grade_manager.py that implements a Student Grade Management System. Your program should process student data, perform calculations, and generate beautifully formatted reports using all the string manipulation techniques you have learned.

Important: This assignment is designed to be completed without using lists, dictionaries, or file handling - those concepts come later! Focus on working with individual variables, data types, and string operations.
03

Sample Data

Your program should work with the following sample student data. You will collect this information through user input and then process it.

Sample Student Information

Here is an example of the data your program should be able to handle. You will ask the user to enter this type of information:

Field Example Value Data Type Notes
Student ID STU-2024-001 str Text with letters, numbers, and hyphens
Full Name rahul sharma str May be entered in lowercase (you need to format it)
Age 16 int Whole number, entered as string, needs conversion
Math Score 85.5 float Out of 100, can have decimals
Science Score 78.0 float Out of 100, can have decimals
English Score 92.5 float Out of 100, can have decimals
Hindi Score 88.0 float Out of 100, can have decimals
Computer Score 95.0 float Out of 100, can have decimals
Grade Calculation Rules

Use the following grading scale for your calculations. This determines the letter grade and grade points based on the average score:

Average Score Range Letter Grade Grade Points Status
90 - 100 A+ 10.0 Outstanding
80 - 89 A 9.0 Excellent
70 - 79 B+ 8.0 Very Good
60 - 69 B 7.0 Good
50 - 59 C 6.0 Average
40 - 49 D 5.0 Below Average
Below 40 F 0.0 Fail
Pass Criteria: A student passes if their average score is 40 or above (grade D or better). Use a bool variable to track pass/fail status.
04

Requirements

Your grade_manager.py must implement ALL of the following features. Each requirement focuses on specific Module 2 concepts.

1
Program Header and Welcome Message

Start your program with a professional header:

  • Display a welcome banner using string multiplication ("=" * 50)
  • Center the title "BrightMind Academy" using .center() method
  • Display the current date (you can hardcode it)
  • Use string concatenation or f-strings for the header
# Example output:
# ==================================================
#           BRIGHTMIND ACADEMY
#        Student Grade Management System
#             Date: January 15, 2026
# ==================================================
2
Collect Student Information (Data Types & Conversion)

Collect the following with proper type handling:

  • Student ID: Keep as str, convert to uppercase using .upper()
  • Full Name: Keep as str, convert to title case using .title()
  • Age: Convert to int using int()
  • Use input().strip() to remove any extra whitespace
# Type conversion examples:
student_id = input("Enter Student ID: ").strip().upper()
full_name = input("Enter Full Name: ").strip().title()
age = int(input("Enter Age: ").strip())
3
Collect Subject Scores (Float Conversion)

Collect scores for all 5 subjects:

  • Convert each score to float for decimal handling
  • Store in descriptively named variables (e.g., math_score, science_score)
  • Display the subject name clearly in the input prompt
# Score collection:
math_score = float(input("Enter Math Score (out of 100): "))
science_score = float(input("Enter Science Score (out of 100): "))
# ... and so on for all 5 subjects
4
Perform Calculations (Arithmetic Operators)

Calculate the following using arithmetic operators:

  • Total Score: Sum of all 5 subject scores (+ operator)
  • Average Score: Total divided by 5 (/ operator)
  • Percentage: (Total / 500) * 100 (* operator)
  • Highest Score: Use max() built-in function
  • Lowest Score: Use min() built-in function
# Calculations:
total_score = math_score + science_score + english_score + hindi_score + computer_score
average_score = total_score / 5
percentage = (total_score / 500) * 100
highest_score = max(math_score, science_score, english_score, hindi_score, computer_score)
lowest_score = min(math_score, science_score, english_score, hindi_score, computer_score)
5
Determine Grade (Comparison Operators)

Use comparison operators to determine the letter grade:

  • Use if/elif/else with comparison operators (>=, <)
  • Assign the correct letter grade, grade points, and status
  • Create a bool variable is_passed (True if average >= 40)
# Grade determination:
if average_score >= 90:
    letter_grade = "A+"
    grade_points = 10.0
    status = "Outstanding"
elif average_score >= 80:
    letter_grade = "A"
    # ... continue for all grades

# Boolean for pass/fail
is_passed = average_score >= 40  # This creates a bool
6
Create Formatted Student ID (String Slicing)

Generate a short ID using string slicing:

  • Extract just the last 3 characters from the student ID
  • Extract the first 3 letters of the first name
  • Combine them to create a short code (e.g., "001-RAH")
# String slicing:
short_id = student_id[-3:]  # Last 3 characters
first_name = full_name.split()[0]  # Get first name
name_code = first_name[:3].upper()  # First 3 letters, uppercase
student_code = f"{short_id}-{name_code}"  # Combined: "001-RAH"
7
Generate Report Card (String Formatting)

Create a beautifully formatted report card using f-strings:

  • Use .center(), .ljust(), .rjust() for alignment
  • Format numbers with specific decimal places (e.g., {score:.2f})
  • Use string multiplication for borders ("-" * 40)
  • Display all information in a neat, tabular format
# Formatted report card example:
print("=" * 50)
print("STUDENT REPORT CARD".center(50))
print("=" * 50)
print(f"{'Student ID:':<20}{student_id:>28}")
print(f"{'Name:':<20}{full_name:>28}")
print(f"{'Age:':<20}{age:>28}")
print("-" * 50)
print(f"{'Subject':<20}{'Score':>15}{'Out of':>13}")
print("-" * 50)
print(f"{'Mathematics':<20}{math_score:>15.2f}{'100':>13}")
# ... continue for all subjects
8
Display Performance Analysis (String Methods)

Add a performance analysis section using various string methods:

  • Show the status message in uppercase (.upper())
  • Create a visual grade bar using string multiplication
  • Display pass/fail using boolean with ternary expression
  • Use .replace() to customize messages
# Performance analysis:
print("\n" + "PERFORMANCE ANALYSIS".center(50, "-"))

# Visual grade bar (10 blocks for 100%)
filled_blocks = int(percentage // 10)
empty_blocks = 10 - filled_blocks
grade_bar = "█" * filled_blocks + "░" * empty_blocks

print(f"Performance: [{grade_bar}] {percentage:.1f}%")
print(f"Result: {'✓ PASSED' if is_passed else '✗ FAILED'}")
print(f"Status: {status.upper()}")
9
Generate Email ID (String Concatenation & Methods)

Create a suggested email ID for the student:

  • Use the first name (lowercase) + last 3 digits of ID
  • Add the school domain (@brightmind.edu)
  • Remove any spaces and special characters using .replace()
  • Ensure all lowercase using .lower()
# Generate email:
first_name_clean = first_name.lower().replace(" ", "")
id_digits = student_id[-3:]
email = f"{first_name_clean}{id_digits}@brightmind.edu"
print(f"Suggested Email: {email}")
10
Display Type Information (type() Demonstration)

Add a debug section showing data types (for learning purposes):

  • Display the type of key variables using type()
  • Show that you understand what type each variable holds
  • This demonstrates your understanding of data types
# Data Types Debug Section (optional to display)
print("\n" + "DATA TYPES USED".center(50, "-"))
print(f"student_id: {type(student_id).__name__}")  # str
print(f"age: {type(age).__name__}")                # int
print(f"math_score: {type(math_score).__name__}")  # float
print(f"is_passed: {type(is_passed).__name__}")    # bool
11
Code Quality Requirements

Your code must follow these standards:

  • Header Comment: Include your name, date, and program description
  • Section Comments: Separate each section with descriptive comments
  • Variable Names: Use descriptive snake_case names
  • Indentation: Use 4 spaces consistently
  • Blank Lines: Separate logical sections with blank lines
  • No External Libraries: Use only built-in Python features
05

Submission

Create a public GitHub repository with the exact name shown below:

Required Repository Name
python-grade-manager
github.com/<your-username>/python-grade-manager
Required Files
python-grade-manager/
├── grade_manager.py          # Your main Python file with all code
├── sample_output.txt         # Copy of your program's output when run
└── README.md                 # Required documentation (see below)
README.md Must Include:
  • Your full name and submission date
  • Brief description of your solution approach
  • List of data types used and where you used them
  • List of string methods used in your program
  • Any challenges faced and how you solved them
  • Instructions to run your program
Do Include
  • All 11 requirements implemented
  • Proper use of all 4 data types (str, int, float, bool)
  • At least 5 different string methods
  • String slicing for ID/name manipulation
  • f-strings with format specifiers
  • Alignment methods (center, ljust, rjust)
  • Comments explaining your code
  • Sample output file
Do Not Include
  • Lists, dictionaries, or tuples (Module 4 topics)
  • Functions or classes (Module 5 & 6 topics)
  • File handling (Module 8 topic)
  • External libraries or imports
  • Code that doesn't run without errors
  • Hardcoded calculations (must use variables)
  • Any .pyc or __pycache__ files
Important: Before submitting, run your program multiple times with different inputs to make sure it works correctly with various student names, IDs, and scores!
Submit Your Assignment

Enter your GitHub username - we'll verify your repository automatically

06

Grading Rubric

Your assignment will be graded on the following criteria:

Criteria Points Description
Data Types (2.1) 30 Correct use of str, int, float, bool with proper type conversions
Operators (2.2) 25 Arithmetic operators for calculations, comparison operators for grade logic
String Methods (2.3) 35 Use of upper, lower, title, strip, center, ljust, rjust, replace, split
String Formatting (2.3) 25 f-strings with format specifiers, proper alignment, number formatting
String Slicing (2.3) 15 Correct use of slicing to extract parts of strings
Code Quality 20 Comments, naming conventions, organization, and readability
Total 150

Ready to Submit?

Make sure you have completed all requirements and reviewed the grading rubric above.

Submit Your Assignment
07

What You Will Practice

Data Types (2.1)

Working with str, int, float, bool - understanding when to use each type and how to convert between them

Operators (2.2)

Arithmetic (+, -, *, /), comparison (>=, <, ==), and assignment operators for real calculations

String Methods (2.3)

Using upper(), lower(), title(), strip(), split(), replace(), center(), ljust(), rjust() for text processing

String Slicing (2.3)

Extracting parts of strings using [start:end] notation, negative indices, and step values

String Formatting (2.3)

Creating professional output with f-strings, format specifiers ({:.2f}), and alignment options

Clean Code Practices

Writing readable code with proper comments, variable naming, and logical organization

08

Pro Tips

Data Types
  • Always use int() for whole numbers like age
  • Use float() for scores that can have decimals
  • Remember: input() always returns a string!
  • Booleans are great for pass/fail conditions
String Methods
  • Chain methods: input().strip().title()
  • Use .format() or f-strings for neat output
  • "{:>10}".format(x) right-aligns in 10 spaces
  • String multiplication: "=" * 50 for borders
String Slicing
  • text[0:3] = first 3 characters
  • text[-3:] = last 3 characters
  • text[::-1] = reversed string
  • Always check string length before slicing
Common Mistakes
  • Forgetting to convert input to int/float
  • Comparing string numbers (use int/float first)
  • Using == instead of = for assignment
  • Forgetting to handle edge cases (0 scores, etc.)
09

Pre-Submission Checklist

Code Requirements
Repository Requirements