This story is one in a series about U.S. human spaceflight.

Space — with its bulky spacesuits and microgravity — does not seem like a good place for sports. Over the years, however, astronauts have found time to play.

Most famously, astronaut Alan Shepard hid a collapsible golf club in his spacesuit when he stepped out on to the moon’s surface as the commander of Apollo 14 in 1971. Shepard dropped two golf balls in the lunar dust and then swung away with his makeshift 6-iron.

More recently, astronauts have organized relay races as well as tennis and badminton matches on the International Space Station (ISS).

However, it’s not all fun and games in space. There is the very serious business of keeping astronauts fit and healthy in a microgravity environment. Remember, astronauts are staying in space for longer periods of time. In recent years, Scott Kelly and his Russian counterpart, Mikhail Kornienko, spent almost a full year (340 days) on the ISS.

Being in a weightless environment can cause muscles to grow weak and bones to become more brittle. Weightlessness is also hard on the heart because with little gravity the heart does not have to work as hard to pump blood to all parts of the body.

Some have compared being in space for long periods to being in bed for months at a time. The body grows weak without moving around and without regular exercise.

So how do astronauts exercise and stay in shape in space? It’s a tricky question because almost all exercises — lifting weights, running, jumping — make the body stronger because the body is fighting against gravity.

I asked Sunita “Suni” (pronounced Sunny) Williams for some answers. She has been an astronaut for 20 years and has spent more than 300 days in space. Williams has also logged more than 50 hours on spacewalks. She is training for a six-month mission on the ISS scheduled to begin next year.

Williams said it helps to be in good shape before you blast off. An astronaut needs to be at a certain level of fitness so she can do the work in space. Spacewalks, according to Williams, are especially exhausting. Several hours working outside the ISS can feel “like a whole day of skiing.”

Williams, who is 53, started getting in shape as a girl growing up in Needham, Massachusetts. She was a competitive swimmer who also hiked, ran cross-country and played soccer. Williams still runs and even brought her passion for running into space.

The astronauts on the ISS (there are usually six) have to work out two hours every day. They spend about an hour exercising their legs and heart by pedaling a stationary bike and running on a treadmill.

The computerized treadmill is not the kind you would see at a local gym. The astronauts have to wear a special harness and belts to keep them from floating off the machine.

Williams used the treadmill to run in the Boston Marathon in 2007. She had qualified for the famous 26.2-mile event but was going to be in space during the actual running of the race. Her sister contacted race organizers and asked if Williams could run anyway . . . on the ISS treadmill.

The race organizers said okay. So Williams hopped on the treadmill at the beginning of the marathon and ran the entire distance. She even had an official race number.

The astronauts also “lift weights” to keep their upper body in shape. Of course, they don’t actually lift weights because everything is weightless in space. Instead, they use a Resistance Exercise Device that has the astronaut pulling, pumping and squatting against the force of a vacuum.

Williams’s advice to kids who think all this microgravity stuff sounds like fun?

First, “don’t take your health for granted” and “stay in shape.” Astronauts will have to be in good physical condition to endure long space travel and to work on Mars. “We are not sending people to Mars to be couch potatoes,” she said.

Williams encourages kids to get used to thinking “out of the box.” Everything about this weightless world requires people to think in new and creative ways.

Such as when the NASA engineers and astronauts continue to wonder: How do you stay fit in space?