You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
647 B

def do_foo():
if n % 2 == 1:
print('Weird')
return
if 1 < n < 6:
print('Not Weird')
if 5 < n < 12:
print('Weird')
if 19 < n:
print('Not Weird')
def log_base_10(n):
if n == 0:
return float('-inf') # Logarithm of 0 is undefined
count = 0
while n >= 1:
n /= 10
count += 1
return count
if __name__ == '__main__':
n = 102
out = 0
for i in range(1, n + 1):
power = (i // 10 + 1)
# print(i, i / 10, log_base_10(i), pow(10, log_base_10(i) - 1), pow(10, power))
out = out * pow(10, log_base_10(i)) + i
print(out)