Week3 Exceptions Fuel Gauge 题目描述: 输入分数字符串,判断并输出相应的百分数;特例不足1%输出E,超出99%输出F 思路: 1,从字符串中取出x,y; 2,按题中要求计算输出; 题解: while True: try: ## 取出x,y x, z, y= input(&
fuel.py def main(): print(gauge(convert(input("Fraction: "))) def convert(fraction): while True: try: x, y = map(int, fraction.split("/")) if y == 0: raise ZeroDivisionError if x > y: raise ValueError return round(x / y * 100) except (ValueError, ZeroDivisionError): pass def...
python learning-python edx cs50 learning-by-doing pset harvard harvardx learn-python harvardcs50 cs50problemsets cs50problemsetssolved cs50p cs50python cs50p2022 Resources Readme License MIT license Activity Stars 15 stars Watchers 1 watching Forks 5 forks Report repository Languages Py...
CS50’s Introduction to Programming with PythonThese are my solutions for CS50's Introduction to Programming with Python 2022.Final Project: Instagram Scraper⚠️ Disclaimer:❗ The following codes are for educational purpose only and not intended to be used / submitted as your own solutions....