実現したいこと
小数点以下の桁数指定を変数で行いたいです.
実行したプログラム
python3
1import random 2n = random.randint(1,9) 3m = random.random() 4 5print("{0: .nf}".format(m))
エラー
Traceback (most recent call last): File "Main.py", line 7, in <module> print("{0: .nf}".format(m)) ValueError: Format specifier missing precision

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/16 06:48