Changes

Jump to: navigation, search

OPS445 Online Lab7

98 bytes added, 16:35, 14 November 2023
added double 02d to f-string: fix for new version of python
def format_time(t):
"""Return time object (t) as a formatted string"""
return f'%{t.2dhour:%.2d02d}:%.2d' % (t.hour, {t.minute, :02d}:{t.second):02d}'
def sum_times(t1, t2):
cd ~/ops445/lab7/
pwd #confirm that you are in the right directory
ls CheckLab7.py || wget 'https://ictgithub.senecacollege.cacom/~eric.brauersenecaops445/ops445lab7-template/labsblob/LabCheckScriptsmaster/CheckLab7.py?raw=true' -O CheckLab7.py
python3 ./CheckLab7.py -f -v lab7a
</source>
cd ~/ops445/lab7/
pwd #confirm that you are in the right directory
ls CheckLab7.py || wget 'https://ictgithub.senecacollege.cacom/~eric.brauersenecaops445/ops445lab7-template/labsblob/LabCheckScriptsmaster/CheckLab7.py?raw=true' -O CheckLab7.py
python3 ./CheckLab7.py -f -v lab7b
</source>
cd ~/ops445/lab7/
pwd #confirm that you are in the right directory
ls CheckLab7.py || wget 'https://ictgithub.senecacollege.cacom/~eric.brauersenecaops445/ops445lab7-template/labsblob/LabCheckScriptsmaster/CheckLab7.py?raw=true' -O CheckLab7.py
python3 ./CheckLab7.py -f -v lab7c
</source>
def format_time(self):
"""Return time object (t) as a formatted string"""
return f'%{self.2dhour:%.2d02d}:%.2d' % (self.hour, {self.minute, :02d}:{self.second):02d}'
def sum_times(self, t2):
cd ~/ops445/lab7/
pwd #confirm that you are in the right directory
ls CheckLab7.py || wget 'https://ictgithub.senecacollege.cacom/~eric.brauersenecaops445/ops445lab7-template/labsblob/LabCheckScriptsmaster/CheckLab7.py?raw=true' -O CheckLab7.py
python3 ./CheckLab7.py -f -v lab7d
</source>
def __str__(self):
'''return a string representation for the object self'''
return f'%{self.2dhour:%.2d02d}:%.2d' % (self.hour, {self.minute, :02d}:{self.second) :02d}'
</source>
:1. Make a copy of lab7d.py and name it as lab7e.py. Add the function definition for __str__() after the __init__() function in lab7e.py. Make sure that the '''def __str__(self):''' line has the same indentation level as the __init__() function.
cd ~/ops445/lab7/
pwd #confirm that you are in the right directory
ls CheckLab7.py || wget 'https://ictgithub.senecacollege.cacom/~eric.brauersenecaops445/ops445lab7-template/labsblob/LabCheckScriptsmaster/CheckLab7.py?raw=true' -O CheckLab7.py
python3 ./CheckLab7.py -f -v lab7e
</source>
cd ~/ops445/lab7/
pwd #confirm that you are in the right directory
ls CheckLab7.py || wget 'https://ictgithub.senecacollege.cacom/~eric.brauersenecaops445/ops445lab7-template/labsblob/LabCheckScriptsmaster/CheckLab7.py?raw=true' -O CheckLab7.py
python3 ./CheckLab7.py -f -v lab7f
</source>
cd ~/ops445/lab7/
pwd #confirm that you are in the right directory
ls CheckLab7.py || wget 'https://ictgithub.senecacollege.cacom/~eric.brauersenecaops445/ops445lab7-template/labsblob/LabCheckScriptsmaster/CheckLab7.py?raw=true' -O CheckLab7.py
python3 ./CheckLab7.py -f -v lab7i
</source>

Navigation menu