私は、クラス内の男性と女性の数を考慮して、クラス内の男性と女性の割合を計算するプログラムを作成しようとしています。ここでシンプルなPython百科事典
は私が持っているものです。
# Calculate percentage of males and females in a class
males = input("Enter the number of males in the class: ")
females = input("Enter the number of females in the class: ")
total = int(males + females)
mperc = males*100/total
fperc = females*100/total
print ("The class is" mperc, "percent male and" fperc, "percent female")
検証は私に(印刷ラインで)「mperc」に関する間違った構文を語っています。 私はPytonには新しく、これを修正する方法がわからない。どんな助けも素晴らしいだろう!