Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #this program is really inefficient at calculating logarithms
- print("Please enter a number to get the log of")
- inputValue = input()
- inputValue = int(inputValue)
- if inputValue < 10:
- print("0", end = "")
- inputValue = inputValue ** 10
- elif inputValue < 10**2:
- print("1", end = "")
- inputValue = inputValue/10
- inputValue = inputValue ** 10
- elif inputValue < 10**3:
- print("2", end = "")
- inputValue = inputValue/10**2
- inputValue = inputValue ** 10
- elif inputValue < 10**4:
- print("3", end = "")
- inputValue = inputValue/10**3
- inputValue = inputValue ** 10
- elif inputValue < 10**5:
- print("4", end = "")
- inputValue = inputValue/10**4
- inputValue = inputValue ** 10
- elif inputValue < 10**6:
- print("5", end = "")
- inputValue = inputValue/10**5
- inputValue = inputValue ** 10
- elif inputValue < 10**7:
- print("6", end = "")
- inputValue = inputValue/10**6
- inputValue = inputValue ** 10
- elif inputValue < 10**8:
- print("7", end = "")
- inputValue = inputValue/10**7
- inputValue = inputValue ** 10
- elif inputValue < 10**9:
- print("8", end = "")
- inputValue = inputValue/10**8
- inputValue = inputValue ** 10
- elif inputValue < 10**10:
- print("9", end = "")
- inputValue = inputValue/10**9
- inputValue = inputValue ** 10
- elif inputValue < 10**11:
- print("10", end = "")
- inputValue = inputValue/10**10
- inputValue = inputValue ** 10
- elif inputValue < 10**12:
- print("11", end = "")
- inputValue = inputValue/10**11
- inputValue = inputValue ** 10
- elif inputValue >= 10**13:
- print("Use a smaller number")
- print(".", end = "")
- for x in range(0, 20):
- if inputValue < 10:
- print("0", end = "")
- inputValue = inputValue ** 10
- elif inputValue < 10**2:
- print("1", end = "")
- inputValue = inputValue/10
- inputValue = inputValue ** 10
- elif inputValue < 10**3:
- print("2", end = "")
- inputValue = inputValue/10**2
- inputValue = inputValue ** 10
- elif inputValue < 10**4:
- print("3", end = "")
- inputValue = inputValue/10**3
- inputValue = inputValue ** 10
- elif inputValue < 10**5:
- print("4", end = "")
- inputValue = inputValue/10**4
- inputValue = inputValue ** 10
- elif inputValue < 10**6:
- print("5", end = "")
- inputValue = inputValue/10**5
- inputValue = inputValue ** 10
- elif inputValue < 10**7:
- print("6", end = "")
- inputValue = inputValue/10**6
- inputValue = inputValue ** 10
- elif inputValue < 10**8:
- print("7", end = "")
- inputValue = inputValue/10**7
- inputValue = inputValue ** 10
- elif inputValue < 10**9:
- print("8", end = "")
- inputValue = inputValue/10**8
- inputValue = inputValue ** 10
- elif inputValue < 10**10:
- print("9", end = "")
- inputValue = inputValue/10**9
- inputValue = inputValue ** 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement