MIT 6.0001 ps0

Assignment:
Write a program that does the following in order:

  1. Asks the user to enter a number “x”
  2. Asks the user to enter a number “y”
  3. Prints out number “x”, raised to the power “y”.
  4. Prints out the log (base 2) of “x”.
import math
# import numpy as np
x = int(input('Enter number x:'))
y = int(input('Enter number y:'))
print('X**y = %d' % (x**y))
print('log(x)=%d' % (math.log(x,2)))
# print('log(x)=%d' % np.log2(x))
posted @ 2020-03-04 14:29  Wiikk  阅读(201)  评论(0编辑  收藏  举报