hello everybody im trying to compute the log(n) while n in the first time =10 and second time =100 , third =1000 and fourth = 10000
but an error still happenening
the error is math domain error
can anybody help in this code and error

import math
import logging

n = 0
while n <= 10:
    print(math.log(n))
    n = n + 1

Recommended Answers

All 2 Replies

Could it be trying to get the log of a number that is less than or equal to zero?

Example that works:

import math
import logging
n = 1
while n <= 10:
    print(math.log(n))
    n = n + 1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.