can someone provide working code for this?

can someone provide working code for this?