In this problem, you have to write a Python program to print an encoding of the ids of the teams whose jersey colour at home is different from the jersey colour when they play away from home.
The encoding must be using a shift cipher, which is detailed below.
An alphabet is mapped to another alphabet as follows. For a given alphabet α, let pos be the position at which α occurs in the alphabet listing (A at 1, B at 2, …. Z at 26). Then the encoding of α is the alphabet at the position (pos + 7) mod 26.
For example, if M is the alphabet, then the position at which M occurs in the alphabet listing is 13. Then, the encoding of M is the alphabet at the position (13 + 7) mod 26 = 20, which is T.
For each digit β, the encoding of β is (β+7) mod 10.
For example, if 3 is the digit, then the encoding of 3 is the number (3 + 7) mod 10 = 0.
The ids should be listed in the ascending order before performing the encoding.
Each line in the output of the program must correspond to one row retrieved from the table.
CREATE TABLE "public"."teams" (
"team_id" varchar(10) NOT NULL,
"name" varchar(80) NOT NULL,
"city" varchar(80) NOT NULL,
"playground" varchar(80) NOT NULL,
"jersey_home_color" varchar(80),
"jersey_away_color" varchar(80),
PRIMARY KEY ("team_id")
);
CREATE TABLE "public"."managers" (
"mgr_id" varchar(10) NOT NULL,
"name" varchar(80) NOT NULL,
"dob" date NOT NULL,
"team_id" varchar(10),
"since" date,
PRIMARY KEY ("mgr_id")
);
CREATE TABLE "public"."matches" (
"match_num" varchar(10) NOT NULL,
"match_date" date NOT NULL,
"host_team_id" varchar(10) NOT NULL,
"guest_team_id" varchar(10) NOT NULL,
"host_team_score" int4 NOT NULL,
"guest_team_score" int4 NOT NULL,
PRIMARY KEY ("match_num")
);
CREATE TABLE "public"."match_referees" (
"match_num" varchar(10) NOT NULL,
"referee" varchar(15),
"assistant_referee_1" varchar(15),
"assistant_referee_2" varchar(15),
"fourth_referee" varchar(15),
PRIMARY KEY ("match_num")
);
CREATE TABLE "public"."referees" (
"referee_id" varchar(10) NOT NULL,
"name" varchar(80) NOT NULL,
"dob" date NOT NULL,
PRIMARY KEY ("referee_id")
);
CREATE TABLE "public"."players" (
"player_id" varchar(10) NOT NULL,
"name" varchar(80) NOT NULL,
"dob" date NOT NULL,
"jersey_no" int4 NOT NULL,
"team_id" varchar(10) NOT NULL,
PRIMARY KEY ("player_id")
);