Hi, i was having problem with a question i encountered. It was to create a life path program using python. However, i have no idea where to start. It says first to input the data for day, month and year. then it said to convert each day/month/year to a single digit? i was told to use if/else statements

all answers would be appreicated.

Recommended Answers

All 4 Replies

Our rule is to only give homework help to students who show effort, so the first step is to post your attempts to solve the problem in the form of python code. Start with the code to get day, month and year from the user.

So let's say I have the
number 22
and i want to split it to 2 2 and then add it

I understand the concept of adding it using num= # + #

but for splitting it into the component 22 into 2 2 is proving difficult for me. I think it has to do with converting from integer to string?

divmod function might prove helpfull as alternative (or integer division and %)

hmm i never though about that, but thanks for the suggestion

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.