Help with programmi...
 
Notifications
Clear all

Help with programming homework when you're still learning the basics

13 Posts
12 Users
0 Reactions
41 Views
LunarEclipse
(@lunareclipse)
Eminent Member
Joined: 2 weeks ago
Posts: 22
Topic starter  

Hey everyone! I desperately need help with programming homework for my intro to Python class. I'm completely new to coding (taking it as an elective) and I feel like I'm drowning. We just started learning about functions and loops last week, and now we have this assignment due Friday where we need to create a program that:
1. Reads data from a file
2. Processes it using functions
3. Creates some kind of analysis with loops

I don't even know where to begin! Any tips for absolute beginners? 😭



   
Quote
Z3roGravity
(@z3rogravity)
Eminent Member
Joined: 2 weeks ago
Posts: 22
 

Been there! For help with programming homework, start by breaking down the problem into smaller steps. Don't try to code everything at once.

For your file reading task:
```python
# This opens a file and reads the content
with open('yourfilename.txt', 'r') as file:
data = file.readlines()
```

That's just step 1. What kind of data are you working with? That will help determine the next steps for processing.



   
ReplyQuote
LunarEclipse
(@lunareclipse)
Eminent Member
Joined: 2 weeks ago
Posts: 22
Topic starter  

@Z3roGravity Thanks! The file is a CSV with student data (name, grade, attendance). We're supposed to calculate average grades and identify students with attendance below 80%... but I'm still confused about how to structure the functions and loops.



   
ReplyQuote
DarkWolfX
(@darkwolfx)
Eminent Member
Joined: 4 weeks ago
Posts: 24
 

When I was learning Python and needed programming homework help, I found it helpful to sketch out the program structure before writing any code. Try this approach:

1. Function to read the file (like Z3roGravity showed)
2. Function to calculate average grade
3. Function to check attendance
4. Main loop to process each student

Start with one function at a time, test it, then move on to the next. Don't try to write everything at once!



   
ReplyQuote
NeonPhantom77
(@neonphantom77)
Eminent Member
Joined: 4 weeks ago
Posts: 26
 

Let me add to the great advice you've already gotten! For help with programming homework, I always recommend these steps:

1. Write pseudocode first (just plain English steps)
2. Convert one step at a time to actual code
3. Test each piece independently

For your CSV file, you might want to use the built-in csv module which makes handling CSV files much easier:

```python
import csv

def read_data(filename):
students = []
with open(filename, 'r') as file:
csv_reader = csv.reader(file)
next(csv_reader) # Skip header row if you have one
for row in csv_reader:
name, grade, attendance = row
students.append({
'name': name,
'grade': float(grade),
'attendance': float(attendance)
})
return students
```



   
ReplyQuote
Michael_StormX
(@michael_stormx)
Eminent Member
Joined: 3 weeks ago
Posts: 20
 

For beginners looking for programming homework help, I can't recommend Python's official documentation enough. It has great examples for everything you need.

For your assignment, after reading the file, you'll need functions like these:

```python
def calculate_average_grade(students):
total = sum(student['grade'] for student in students)
return total / len(students)

def find_low_attendance(students, threshold=80):
return [student for student in students if student['attendance'] < threshold]
```

Try to understand what each line does rather than just copying. That's how you actually learn!



   
ReplyQuote
ShadowX_99
(@shadowx_99)
Eminent Member
Joined: 4 weeks ago
Posts: 22
 

I was in your exact position last semester! What really helped me with my help with programming homework struggles was using visualization tools. Draw out the flow of your program, and for each step, write exactly what data you have and what you want to do with it.

For loops especially, I like to manually trace through a few iterations with sample data to make sure I understand what's happening. Like:

```
Iteration 1: student = {'name': 'Alice', 'grade': 92, 'attendance': 85}
Is attendance < 80? No, so skip

Iteration 2: student = {'name': 'Bob', 'grade': 78, 'attendance': 65}
Is attendance < 80? Yes, so add to list
```

This helps me catch bugs before they happen!



   
ReplyQuote
PixelN1nja
(@pixeln1nja)
Eminent Member
Joined: 4 weeks ago
Posts: 22
 

someone told me to check out https://essays.studymoose.com/ when i needed do my programming homework help last semester. they have example code with explanations that helped me understand the concepts. honestly sometimes seeing a complete working example makes things click better than trying to piece it together yourself.

also don't be afraid to use print statements EVERYWHERE to see what your code is doing! seriously, i put them after almost every line when i'm learning something new.



   
ReplyQuote
Aiden_Walker77
(@aiden_walker77)
Eminent Member
Joined: 2 weeks ago
Posts: 24
 

When I was learning, I found it helpful to start with a template and fill in the pieces. Here's a structure for your help with programming homework assignment:

```python
import csv

def read_data(filename):
# Your code to read the file
pass

def calculate_average(students):
# Your code to calculate average
pass

def find_low_attendance(students, threshold):
# Your code to find students below threshold
pass

def main():
# 1. Read the data
students = read_data('student_data.csv')

# 2. Calculate average grade
avg_grade = calculate_average(students)
print(f"Average grade: {avg_grade}")

# 3. Find students with low attendance
low_attendance = find_low_attendance(students, 80)
print("Students with low attendance:")
for student in low_attendance:
print(f"- {student['name']}")

if __name__ == "__main__":
main()
```

Fill in each function one at a time and test it!



   
ReplyQuote
JakeTThompson
(@jaketthompson)
Eminent Member
Joined: 2 weeks ago
Posts: 20
 

@LunarEclipse I tutor intro programming, and here's my advice for programming homework help:

1. Always start by understanding the problem completely
2. Break it down into sub-problems
3. Solve each sub-problem
4. Integrate the solutions

For your CSV problem, the sub-problems are:
- Reading a file (Use `csv` module)
- Storing the data (Use lists and dictionaries)
- Calculating statistics (Use loops and conditionals)
- Displaying results (Use print statements)

Also, check out edubirdie.com for some programming examples if you get stuck.



   
ReplyQuote
CyberVortex_21
(@cybervortex_21)
Eminent Member
Joined: 3 weeks ago
Posts: 27
 

Something that really helped me when I was looking for help with programming homework was starting with a "skeleton" program with just comments, then filling in one piece at a time:

```python
# Import necessary libraries
import csv

# Function to read and parse the CSV file
def read_student_data(filename):
# TODO: Open the file
# TODO: Read each line
# TODO: Parse into student objects
# TODO: Return list of students

# Function to calculate average grade
def calculate_average_grade(students):
# TODO: Sum up all grades
# TODO: Divide by number of students
# TODO: Return average

# Function to find students with low attendance
def find_low_attendance(students, threshold):
# TODO: Loop through students
# TODO: Check each student's attendance
# TODO: Return list of students below threshold

# Main program
def main():
# TODO: Call read_student_data()
# TODO: Call calculate_average_grade()
# TODO: Call find_low_attendance()
# TODO: Print results

# Call the main function
if __name__ == "__main__":
main()
```

Then fill in each TODO one by one!



   
ReplyQuote
Omega_Byte99
(@omega_byte99)
Eminent Member
Joined: 2 weeks ago
Posts: 20
 

When I was learning programming and needed do my programming homework assistance, I found it helpful to use the "rubber duck debugging" method: explain your code line by line to an imaginary rubber duck (or real one if you have it 😂).

This forces you to think through your logic and often helps you spot errors or gaps in your understanding.

Also, for your assignment specifically, make sure you handle potential errors like:
- What if the file doesn't exist?
- What if there's missing data?
- What if you try to divide by zero?

These considerations show your professor you're thinking like a real programmer!



   
ReplyQuote
EchoStorm
(@echostorm)
Active Member
Joined: 4 weeks ago
Posts: 16
 

i was in your exact situation last year! one thing that helped me with programming homework help was finding similar examples online and modifying them for my needs. here's a full solution that might help you understand the concepts (with comments explaining each part):

```python
import csv

# Function to read student data from CSV
def read_student_data(filename):
students = []
try:
with open(filename, 'r') as file:
reader = csv.reader(file)
next(reader) # Skip header row
for row in reader:
# Create a dictionary for each student
student = {
'name': row[0],
'grade': float(row[1]),
'attendance': float(row[2])
}
students.append(student)
return students
except FileNotFoundError:
print(f"Error: File {filename} not found.")
return []

# Function to calculate average grade
def calculate_average_grade(students):
if not students:
return 0
total = 0
for student in students:
total += student['grade']
return total / len(students)

# Function to find students with attendance below threshold
def find_low_attendance(students, threshold):
low_attendance = []
for student in students:
if student['attendance'] < threshold:
low_attendance.append(student)
return low_attendance

def main():
# Step 1: Read data from file
students = read_student_data('students.csv')

if not students:
print("No students to analyze.")
return

# Step 2: Calculate average grade
avg_grade = calculate_average_grade(students)
print(f"Average grade: {avg_grade:.2f}")

# Step 3: Find students with low attendance
threshold = 80
low_attendance = find_low_attendance(students, threshold)

# Print results
print(f"\nStudents with attendance below {threshold}%:")
for student in low_attendance:
print(f"- {student['name']}: {student['attendance']}%")

if __name__ == "__main__":
main()
```



   
ReplyQuote
Share: