The logarithmic value

Report a typo

Whoa! This problem is much more complex than the usual one and requires knowledge of if-else statements. If you're feeling up to the challenge, brace yourself and good luck! Otherwise, you can skip it for now and return any time later

Write a program that reads two integers (the first is always positive) and calculates the logarithmic value of the first integer with the second integer as a base. If the second integer is negative, 0 or 1, return the natural log of the first number.

Use the function log() from the math module. With one argument, it returns the natural logarithm of a number. It can also take two arguments: a number and a logarithmic base.

Print the result rounded to 2 decimal places.

Sample Input 1:

56
2

Sample Output 1:

5.81
Write a program in Python 3





___

Create a free account to access the full topic