Continuity of a function between two topological spaces.

I am have two problems I am having a little trouble with figuring out.

1. f: (X,T)->(Y,D) where D is the discrete topology is always continuous. There are two cases that must be proven: f^-1(empty set) is open on the topology T and f^-1(Y) is open on the topology T. The problem I am having is with f^-1(Y), how can you be certain it is equal to X? I am not sure how to prove this fact.

2. If f: (X,T)->(Y,S) is continuous and A is a subset of X, show that f|A: (A,T)->(Y,S) is continuous. I know since A is a subset of X that for all the open sets in the topological space (A,T) there is some open set V in (Y,S) such that f^-1(V) is equal to that set, but I am not sure how you can be certain that for all open sets V in S that f^-1(V) is still always open.