Python Forum
I'm having trouble with a test case using python
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm having trouble with a test case using python
#1
In this lab the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter-controlled while loop.

Write a for loop that uses the loop control variable to take on the values 0 through 10.
In the body of the loop, multiply the value of the loop control variable by 2 and by 10.
Execute the program and verify that the output is correct.

I figured out the for loop in the assignment, is still having issue with the test code

# NewMultiply.py - This program prints the numbers 0 through 10 along
# with these values multiplied by 2 and by 10.
# Input:
# Output: Prints the numbers 0 through 10 along with their values multiplied by 2 and by 10.

head1 = "Number:4 "
head2 = "Multiplied by 2:"
head3 = "Multiplied by 10: "

NUM_LOOP_START = 0 # Constant used to control loop
NUM_LOOP_END = 10 # Constant used to control loop

print("0 through 10 multiplied by 2 and by 10.")
#List of values
values=[0,8,40,14,70]
# Write your for loop here
for value in values:
print(value)


THANK YOU!
Reply
#2
We need to see what you have tried. Though we are happy to offer advice, we are not going to write the code for you.  Also, when you post, be sure to post all code, output and error codes (in their respective tags). Refer to the BBCode section of the Help document for information.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Homework Python unit test Paragoon2 4 1,518 Dec-12-2022, 12:45 PM
Last Post: Paragoon2
  Python trouble #1 Cicada3301 5 2,106 Nov-17-2021, 09:35 PM
Last Post: Cicada3301
  Unit Testing is not showing Test case result mbilalshafiq 2 1,803 Jul-01-2020, 08:50 PM
Last Post: mbilalshafiq
  Trouble with edX Python Final sarah_mb_sues 11 13,734 Jun-19-2018, 10:36 AM
Last Post: cryomick
  Online test trouble Joseri 5 12,197 Dec-19-2016, 07:05 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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