<｜begin▁of▁sentence｜>### Instruction:
Given a bipartite graph with edges [('A', 1), ('A', 2), ('B', 2), ('C', 3)], where 'A', 'B', 'C' are in one set and '1', '2', '3' are in the other set, how can you calculate the degree of the nodes in each set using NetworkX?
### Response:
import networkx as nx
from networkx.algorithms import bipartite

# Create a bipartite graph
B = nx.Graph()
B.add_nodes_from(['A', 'B', 'C'], bipartite=0)
B.add_nodes_from([1, 2, 3], bipartite=1)
B.add_edges_from([('A', 1), ('A', 2), ('B', 2), ('C', 3)])

# Define one set of nodes
nodes = set([1, 2, 3])

# Get the degrees of the nodes
degX, degY = bipartite.degrees(B, nodes)

# Convert to dictionary for easier viewing
degree_dict_X = dict(degX)
degree_dict_Y = dict(degY)

print('Degrees for set X:', degree_dict_X)
print('Degrees for set Y:', degree_dict_Y)
<|EOT|>
