ESP8266 not logging into WiFi

I have a ESP8266 Lolin wemos.cc clone.
and I’m following the instructions from an online course with their sketch on how to login to WiFi.
there are no connects to bug up the works and the code is straight forward.

#include <ESP8266WiFi.h>

const char ssid[] = "17243";
const char password[] = "235689147";

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);
  delay(100);

  Serial.print("Connecting to " );
  Serial.print(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println();

  Serial.println("Connected..");
}

void loop()
{
  // put your main code here, to run repeatedly:

}

I reset my router to factory settings and issued a new password just to make sure.
I took a photo of the back of it to look at the ssid “17243-5G”
I’ve tried variations of the ssid with and without the ‘-5G’ but its still refusing to login.
it just keeps printing periods.

can you suggest anything?

I reset my router to factory settings

Then you no longer have an internet connection... (won't stop you connecting to WiFi).

This works on my ESP8266s

#define STASSID "Your SSID"
#define STAPSK  "Your password"
const char * ssid = STASSID;
const char * pass = STAPSK;


uint8_t wait = 0;
  while (WiFi.status() != WL_CONNECTED) {
    if (wait) {
      --wait;
    }
    else {
      wait = 40;
      WiFi.mode(WIFI_STA);
      WiFi.begin(ssid, pass);
    }
 }

Try connecting another device to your WiFi using the credentials you have and see if it connects OK. At the moment you don't know if the problem is your access point or not.

thanks for your suggestion, but I tried it and it doesn't work either.
not sure what to do now.

I have just tried your code on a D1 mini and it works fine.

Note that the router's admin login password may not work as the password for the wifi login. My Arris has what it calls the "Pre-Shared Key" that I use with the wifi board login.