Created
May 13, 2020 13:15
-
-
Save pandanote-info/94ced36deb5435654b676accf9213387 to your computer and use it in GitHub Desktop.
第1引数に与えられた数xの最上位の桁以外の桁を0にした数を出力するPython3のプログラム。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import math | |
args = sys.argv | |
x = float(args[1]) | |
n = math.floor(math.log10(x)) | |
y = math.floor(x/math.pow(10,n))*math.pow(10,n) | |
print("{0:d}".format(int(y))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment