def main():
p = get_percent()
if (p <= 0.01):
print("E")
elif(p >= 0.99):
print("F")
else:
per = "{:.2f}".format(p)
percent = int(float(per) * 100)
print(f"{percent}%")
def get_percent():
while True:
try:
user_input = input("Fraction: ")
x, y = user_input.split('/')
x = int(x)
y = int(y)
if x > y:
continue
except ValueError or ZeroDivisionError:
pass
else:
break
p = x / y
return p
main()
def main():
total = 0
food_list = {"Baja Taco": 4.25,"Burrito": 7.50,"Bowl": 8.50,"Nachos": 11.00,"Quesadilla": 8.50,"Super Burrito": 8.50,"Super Quesadilla": 9.50,"Taco": 3.00,"Tortilla Salad": 8.00
}
while True:
try:
user_input = input("Item: ").title()
if user_input in food_list:
total = total + food_list[user_input]
t = "{:.2f}".format(total)
print(f"Total: ${t}")
continue
else:
continue
except ValueError:
pass
except EOFError:
break
main()
def main():
user_list = sorted(addlist(),key =str.lower)
new_list = []
for i in user_list:
if i not in new_list:
print(f"{user_list.count(i)} {i}")
new_list.append(i)
def addlist():
user_list = []
while True:
try:
user_input = input("").upper()
user_list.append(user_input)
except ValueError:
pass
except EOFError:
break
else:
pass
return user_list
main()
def main():
use_list = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
]
while True:
try:
user_input = input("Date: ")
if "/" in user_input:
a, b,c= user_input.split('/')
yyyy = int(c)
mm = int(a)
dd = int(b)
elif "," in user_input:
x , y = user_input.split(',')
yue,ri = x.split(' ')
if yue in use_list:
mm = use_list.index(yue) + 1
dd = ri
yyyy = y.lstrip()
else:
continue
else:
continue
except (NameError, ValueError, TypeError):
pass
else:
if int(dd)<= 31 and 1<=int(mm)<=12:
break
mm = str(mm).strip()
dd = str(dd).lstrip()
yyyy = str(yyyy).lstrip()
if int(mm)<10:
mm= "0"+mm
if int(dd) <10:
dd ="0"+dd
print(f"{yyyy}-{mm}-{dd}")
main()