DEV Community

THR37425
THR37425

Posted on

Python

I am in my second week of learning Python. The questions I have are probably simple for someone who has the experience in any programming language, but I really need to understand how this works. The following is a question I don't understand.


Read user input and print to output.

Read three numbers from user input. Then, print the product of those numbers. Ex: If input is 2 3 5, output is 30. Note: Our system will run your program several times, automatically providing different input values each time, to ensure your program works for any input values.


When I run the following code the question changes to the second question in example 2.

Example: 1

numb1 = 2
numb2 = 3
numb3 = 5
print( numb1 * numb2 * numb3)


Example: 2

Testing with input: 6 4 9

Output differs. See highlights below.

Your output - 30

Expected output - 216


Why is the question being changed when I run the code? When I run the second code changing the numbers to 6 4 9. It tests the input numbers 2 3 5 from the original question.

Does anyone understand this?

Latest comments (5)

Collapse
 
deloresmartin profile image
DeloresMartin

How much does Python cost?
How To Identify Black Magic on A Person

Collapse
 
ittodev profile image
ITtoDev

I am taking a beginner's course on Python right now and was also having an issue with this question but I finally figured it out myself. At least it passes the test anyway. When you look at it, it should make sense if you learned about input, output, and integers. Here it is, go ahead and just copy and paste if you like:

num1 = int(input())
num2 = int(input())
num3 = int(input())
print(num1 * num2 * num3)

Collapse
 
thr37425 profile image
THR37425

Hello, I'm sorry I didn't get back to you sooner.

I've been really busy trying to catch up on one of the classes that I'm taking online. I'm trying to learn office 2016, and it has taken up a lot of my time. The SmartNav handicap application I use doesn't work well with office 2016, and I had to fix several documents more than once to get them right.

If you have time to help me figure this out today I'll be looking for your reply to this post.

Thank you,

Theodore Rahm

Collapse
 
deciduously profile image
Ben Lovy

What system are you working with, and can you provide the full snippet of Python you've written to solve the problem?

Collapse
 
thr37425 profile image
THR37425

Hello, sorry I'm just getting back to you.

I'm using Windows 10. The question is pretty straight forward but when I write the answer the question changes.


1.3.4: Read user input and print to output.

Read three numbers from user input. Then, print the product of those numbers. Ex: If input is 2 3 5, output is 30. Note: Our system will run your program several times, automatically providing different input values each time, to ensure your program works for any input values.

I wrote the following code, but the question changed asking for a different answer.

num1 = 2
num2 = 3
num3 = 5

print(num1 * num2 * num3)

output 30

maybe the second question holds the answer. I found that (int) is used with numbers.

Python | int() function
int() function in Python and Python3 converts a number in given base to decimal. ... string : consists of 1's and 0's base : (integer value) base of the number. Returns : Returns an integer value, which is equivalent of binary string in the given base.


1.3.5: Read user input numbers and perform a calculation.

Read two numbers from user input. Then, print the sum of those numbers.
Hint -- Copy/paste the following code, then just type code where the questions marks are to finish the code.

num1 = int(input())
num2 = ?
print(num1 + ?)

This question ends up the same. The question changes in this activity also. The questions starting with 1.3.4. and 1.3.5. is all I have.

Thank you.

Ted Rahm