How to convert a Public Key into a Wallet Address

import bech32

# public key in compressed format (33 bytes long and starts with 02 or 03)
public_key_hex="02...."

# Convert Compressed Public Key into a Radix Engine Address
readdr_bytes = b"\x04" + bytearray.fromhex(public_key_hex)

# Convert Radix Engine Address to Bech32 Radix Wallet Address
readdr_bytes5 = bech32.convertbits(readdr_bytes, 8, 5)
wallet_address = bech32.bech32_encode("rdx", readdr_bytes5)
print("Wallet Address: ", wallet_address)

Run this code on Replit:

Also see: How to convert a Wallet Address into a Public Key