How to do the PLC input and output connection

Explain how the input and output ports of PLC are connected to the devices

PlC’s mainly operates on the ladder programming. There are different input and output ports in the plc and those inputs are mainly connected with the sensors The sensors are placed in the machine and the output is generally connected to the actuator or motors or any other device which we want to operate. The inputs and output are defined in the program itself the ports are defined in the program