Python Forum
Not sure what I'm supposed to be doing here.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not sure what I'm supposed to be doing here.
#1
Howdy. I'm taking a class on Python in college, and I've come across a problem where I don't know what I'm supposed to be trying to do. I understand that I'm supposed to be completing a program, but I can't figure out what to do to complete it, and have no idea what the goal is supposed to be.

**Please don't give me the answer right away. I would really just appreciate some guidance to point me in the right direction.

Here are the instructions:

Times 11: A two-digit number can be easily multiplied by 11 in one's head simply by adding the digits and inserting that sum between the digits. For example, 43 * 11 has the resulting digits of 4, 4+3, and 3, yielding 473. If the sum between the digits is greater than 9, then the 1 is carried to the hundreds place. Complete the below program.

Here is the program/code:

# Complete the following program

num_in_tens = int(input('Enter the tens digit:\n'))
num_in_ones = int(input('Enter the ones digit:\n'))

num_in = num_in_tens*10 + num_in_ones

print('You entered', num_in)
print(num_in, '* 11 is', num_in*11)

num_out_hundreds = num_in_tens
#num_out_tens = ? FINISH
#num_out_ones = ? FINISH

print('An easy mental way to find the answer is:')
print(num_in_tens, ',', num_in_tens, '+', num_in_ones, ',', num_in_ones)

#Build num_out from its digits:
#num_out = ? + ? + ? FINISH

# Note this line will generate an error until the above program is complete.
print(num_out)

I don't understand what num_out is supposed to be, and I don't understand what "Build num_out from its digits." is supposed to mean.

I've been trying to figure it out for about two hours, now.
Just a reply in another thread where someone said to show what the OP had already tried, and then they would help. I didn't save anything that I've tried, because I didn't realize that it would be needed, but that does make lots of sense to save it. Sorry I don't have that, but I hope that you can still help me with this. I'll be sure to save my future attempts.

Just READ a reply in another thread...
Reply
#2
I think num_out is supposed to be num_in times 11. Building it with digits means to use the "easy mental way" given by the program, using num_out_hundreds/tens/ones variables.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
#Build num_out from its digits:
#num_out = ? + ? + ? FINISH

Why does it give "#num_out = ? + ? + ?" as the format, when it's not the format used to find the number times 11? The format to finding the product of a two-digit number times 11 is "num_tens, num_tens + num_ones, num_ones". This is one of the main things confusing me.

I also don't understand what num_out_tens and num_out_ones is supposed to be. Am I just supposed to guess what those values are supposed to be?
Reply
#4
I'm assuming num_out_tens is the tens digit in the answer, and num_out_ones is the ones digit in the answer.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
I tried that, but all that comes out to is 16, which is completely unrelated.

By the way, thank you for your quick responses.
Reply
#6
Are you multiplying the tens by ten and hundreds by one hundred?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  So many things wrong, it runs but not like its supposed to kasherwood 6 2,638 Sep-26-2020, 04:57 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020