backup
parent
7513b7fdb6
commit
d88c383df2
@ -1,49 +1,84 @@
|
|||||||
# import os
|
from logging import root
|
||||||
# import subprocess
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
# list_files = subprocess.run(["ls", "-l"])
|
class DirectoryItem():
|
||||||
# # list_files2 = subprocess.run(["echo \"Hello World\" && echo \"Hello world 2\""])
|
def __init__(self,rootDir,name) -> None:
|
||||||
# list_files2 = subprocess.run(["echo Hello World && echo Hello World 2",""]);
|
self.name = name
|
||||||
# print("The exit code was: %d" % list_files.returncode)
|
self.path = os.path.join(rootDir,name)
|
||||||
# print("The exit code was: %d" % list_files2.returncode)
|
self.itemList = []
|
||||||
|
sList = os.listdir(self.path)
|
||||||
|
for p in sList:
|
||||||
|
self.itemList.append(DirectoryItem(self.path,p))
|
||||||
|
pass
|
||||||
|
def print(self):
|
||||||
|
print(self.path)
|
||||||
|
for i in self.itemList:
|
||||||
|
i.print();
|
||||||
|
def getItem(self,i):
|
||||||
|
return self.itemList[i]
|
||||||
|
|
||||||
|
class Firmware(DirectoryItem):
|
||||||
|
pass
|
||||||
|
class SubModule(DirectoryItem):
|
||||||
|
pass
|
||||||
|
|
||||||
# def test():
|
class Project(DirectoryItem):
|
||||||
# rootdir = './Projects'
|
pass
|
||||||
|
# def __init__(self,rootDir,name) -> None:
|
||||||
|
# self.name = name
|
||||||
|
# self.path = os.path.join(rootDir,name)
|
||||||
|
# self.itemList = []
|
||||||
|
# sList = os.listdir(self.path)
|
||||||
|
# for p in sList:
|
||||||
|
# self.itemList.append(SubModule(self.path,p))
|
||||||
|
# pass
|
||||||
|
# def print(self):
|
||||||
|
# print(self.path)
|
||||||
|
# for i in self.itemList:
|
||||||
|
# i.print();
|
||||||
|
|
||||||
|
class Projects(DirectoryItem):
|
||||||
|
# def __init__(self, rootDir) -> None:
|
||||||
|
# self.itemList = []
|
||||||
|
# self.path = rootDir
|
||||||
|
# pList = os.listdir(self.path)
|
||||||
|
# for p in pList:
|
||||||
|
# self.itemList.append(Project(self.path,p))
|
||||||
|
# pass
|
||||||
|
# def print(self):
|
||||||
|
# print(self.path)
|
||||||
|
# for i in self.itemList:
|
||||||
|
# i.print();
|
||||||
|
# pass
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rootdir = './Projects'
|
||||||
# projects = os.listdir(rootdir);
|
# projects = os.listdir(rootdir);
|
||||||
# print(projects);
|
# modules = [];
|
||||||
|
# firmwares = [];
|
||||||
|
# for project in projects:
|
||||||
|
# modules.append(os.listdir(os.path.join(rootdir,project)));
|
||||||
|
|
||||||
|
|
||||||
|
# print(modules);
|
||||||
|
|
||||||
# def main():
|
|
||||||
# # test();
|
|
||||||
# # print("hello from main");
|
|
||||||
# pass;
|
|
||||||
|
|
||||||
|
|
||||||
# if __name__ == "__main__":
|
# def test():
|
||||||
# main();
|
# rootdir = './Projects'
|
||||||
|
# projects = os.listdir(rootdir);
|
||||||
|
# print(projects);
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
p = Projects(rootdir,"")
|
||||||
|
p.print()
|
||||||
|
pass;
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main();
|
||||||
|
|
||||||
def gather_info():
|
|
||||||
height = float(input("What is your height? (inches or meters) "))
|
|
||||||
weight = float(input("What is your weight? (pounds or kilograms) "))
|
|
||||||
system = input("Are your measurements in metric or imperial systems? ").lower().strip()
|
|
||||||
return (height, weight, system)
|
|
||||||
def calculate_bmi(weight, height, system='metric'):
|
|
||||||
if system == 'metric':
|
|
||||||
bmi = (weight / (height ** 2))
|
|
||||||
else:
|
|
||||||
bmi = 703 * (weight / (height ** 2))
|
|
||||||
return bmi
|
|
||||||
while True:
|
|
||||||
height, weight, system = gather_info()
|
|
||||||
if system.startswith('i'):
|
|
||||||
bmi = calculate_bmi(weight, system='imperial', height=height)
|
|
||||||
print(f"Your BMI is {bmi}")
|
|
||||||
elif system.startswith('m'):
|
|
||||||
bmi = calculate_bmi(weight, height)
|
|
||||||
print(f"Your BMI is {bmi}")
|
|
||||||
else:
|
|
||||||
print("Error: Unknown measurement system. Please use imperial or metric.")
|
|
||||||
Loading…
Reference in New Issue