0
私の初心者のpythonクラスでは、ユーザが入力した数字、基本的なものについて基本的な算術演算を実行するように求められました。小数点以下2桁の数値を返すことになっていましたが、それを1に拡張することしかできません。小数点が最初の小数点で終了する場合、別の場所を追加する方法はありますか?小数点が後で終了する場合、または無限である場合は、2番目の数値も表示する方法がありますか?浮動小数点数を小数点以下の桁数に拡張する
print "Please enter the month of your birthday as a number.";
print "\t Jan = 1";
print "\t Feb = 2";
print "\t Apr = 3"
print "etc, etc, etc."
num = input("\n");
day = input("What date were you born on?\n");
new = (((((((((((num * 7.0) - 1.0) * 13.0) + day) + 3.0) * 11.0) - num) - day)/10.0) + 11.00)/100.0);
print "You were born in the", new, "month.";
[[小数点以下2桁までの浮動小数点数の制限]]の複製が可能です(https://stackoverflow.com/questions/455612/limiting-floats-to-two-decimal-points) – bphi