'User Input To CSV: Resistance Band Workout Tracker
I'm trying to make a simple application that keeps track of your workout. I can get it to read from the CSV for previous workout data. However, I am having trouble getting user data to replace it. Here is what I have:
import os
import csv
import itertools
benchPressSet = [1,2,3,4,5,6]
benchPressReps = [None]*6
overheadPressSet = [1,2,3,4,5,6]
overheadPressReps =[None]*6
overheadPressBand = [None]*6
skullCrusherSet = [1,2,3,4,5,6]
skullCrusherBand = [None]*6
skullCrusherReps = [None]*6
crossoverSet = [1,2,3,4,5,6]
crossoverBand = [None]*6
crossoverReps = [None]*6
#These are place holders until I make CSV files for them
group = input("Push, Pull, or Legs? :")
group.lower()
if group == "push":
print("---Bench Press---\nPrevious Workout:\n")
benchPressBand = open("C:\\Users\\Andre\\Desktop\\Harambe Workout\\benchPressBand.csv")
band = csv.reader(benchPressBand)
for (a, b, c) in itertools.zip_longest(benchPressSet,band,benchPressReps):
print(f'Set: {a} Band: {b} Reps: {c}')
benchPressBand = open("C:\\Users\\Andre\\Desktop\\Harambe Workout\\benchPressBand.csv")
bands = open("C:\\Users\\Andre\\Desktop\\Harambe Workout\\benchPressBand.csv", 'w')
print("Today's Workout:\n")
for (a, b, c) in itertools.zip_longest(benchPressSet,band,benchPressReps):
print(f'Reps in Set {a}: ')
c = input()
print("What band did you use?: ")
b = input()
band = csv.writer(bands)
band.writerow(b)
benchPressBand.close()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
