import time
import math
import random
from machine import I2C, SoftI2C, Pin
from pico_i2c_lcd import I2cLcd
i2c = SoftI2C(sda=Pin(0), scl=Pin(1), freq=400000)
lcd_address = i2c.scan()[0]
lcd = I2cLcd(i2c, lcd_address, 2, 16)
def calculate_power_and_argument(a, b):
power = math.sqrt(a**2 + b**2)
argument = math.atan2(b, a)
return power, argument
real_part = random.randint(1, 100)
imaginary_part = random.randint(1, 100)
power, argument = calculate_power_and_argument(real_part, imaginary_part)
lcd.clear()
lcd.putstr("Complex Number:\n")
lcd.putstr("{0} + {1}i".format(real_part, imaginary_part))
time.sleep(2)
lcd.clear()
lcd.putstr("Power: {:.2f}\n".format(power))
lcd.putstr("Argument: {:.2f}".format(argument))
time.sleep(10)
lcd.clear()