Clear[coord,metric,inversemetric,affine,riemann,ricci,scalar,einstein,r,θ,φ,n,x,y,z ]

n=3
coord={r,θ,φ}
metric ={{1,0,0},{0,(r^2),r},{0,r,(r^2)((Sin[θ])^2)}}

inversemetric=Simplify[Inverse[metric]]

affine:=affine=Simplify[Table[(1/2)*Sum[(inversemetric[[i,s]])*
(D[metric[[s,j]],coord[[k]] ]+
D[metric[[s,k]],coord[[j]] ]-D[metric[[j,k]],coord[[s]] ]),{s,1,n}],
{i,1,n},{j,1,n},{k,1,n}] ];
listaffine:=Table[If[UnsameQ[affine[[i,j,k]],0],{ToString[Γ[i,j,k]],affine[[i,j,k]]}],{i,1,n},{j,1,n},{k,1,j}]
TableForm [Partition[DeleteCases[Flatten[listaffine],Null],2],TableSpacing ->{2,2}]

riemann:=riemann=Simplify[Table[
D[affine[[i,j,l]],coord[[k]] ]-D[affine[[i,j,k]],coord[[l]] ]+
Sum[affine[[s,j,l]] affine[[i,k,s]]-affine[[s,j,k]] affine[[i,l,s]],
{s,1,n}],
{i,1,n},{j,1,n},{k,1,n},{l,1,n}] ]
listriemann:=Table[If[UnsameQ[riemann[[i,j,k,l]],0],{ToString[R[i,j,k,l]],riemann[[i,j,k,l]]}],{i,1,n},{j,1,n},{k,1,n},{l,1,k}]
TableForm [Partition[DeleteCases[Flatten[listriemann],Null],2],TableSpacing ->{2,2}]

ricci:=ricci=Simplify[Table[Sum[riemann[[i,j,i,l]],{i,1,n}],{j,1,n},{l,1,n}] ]
listricci:=Table[If[UnsameQ[ricci[[j,l]],0],{ToString[R[j,l]],ricci[[j,l]]}],{j,1,n},{l,1,j}]
TableForm [Partition[DeleteCases[Flatten[listricci],Null],2],TableSpacing ->{2,2}]

scalar=Simplify[Sum[inversemetric[[i,j]]ricci[[i,j]],{i,1,n},{j,1,n}] ]

einstein:=einstein=Simplify[ricci-(1/2)scalar*metric]
listeinstein:=Table[If[UnsameQ[einstein[[j,l]],0],{ToString[G[j,l]],einstein[[j,l]]}],{j,1,n},{l,1,j}]
TableForm [Partition[DeleteCases[Flatten[listeinstein],Null],2],TableSpacing ->{2,2}]