Question

So I'm currently doing coding in Python. There's two parts and we're supposed to use loops and nested loops to produce the following outputs:

part A) 0 1 2 3 4 5 6 7 8 9

0 1 2 3 4 5 6 7 8 9

0 1 2 3 4 5 6 7 8 9

0 1 2 3 4 5 6 7 8 9 .... for ten times in total

part B) 0 0 0 0 0 0 0 0 0

1 1 1 1 1 1 1 1 1

2 2 2 2 2 2 2 2 2

3 3 3 3 3 3 3 3 3

4 4 4 4 4 4 4 4 4

5 5 5 5 5 5 5 5 5

6 6 6 6 6 6 6 6 6

7 7 7 7 7 7 7 7 7

8 8 8 8 8 8 8 8 8

9 9 9 9 9 9 9 9 9

___________________________________________________________________________________________________________________________________________

I basically have it all on the right path, but I'm getting these weird random numbers too (it's like it's printing the line number and I couldn't find any way around it)

The code I'm using is:

for i in range(10):

print(i, sep=' ')

for j in range(10):

print(j, end=' ')

And it outputs this (I'll attach a screenshot) Python 3.5.1 Shell File Edit Shell Debug Options Window Help Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01: 38:48) [MSC v.1900 32 bit (Intel)] on win32 Type copyright, credits or license) for more information. 000 00 0 00 00 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4444 44 445 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 7 8 8 8 8 8 8 8 8 8 8 9 Ln: 16 Col: 4 8:17 PM 4/10/2016 Im Cortana. Ask me anything

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
So I'm currently doing coding in Python. There's two parts and we're supposed to use loops...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Python What do the following loops print? Work out the answer by tracing the code, not...

    Python What do the following loops print? Work out the answer by tracing the code, not by using the computer. a. s = 2 for n in range (1, 6): s = s + n print(s) b. s = 1 for n in range (1, 11): n = n + 2 s = s + n print(s) c. S = 1 for in range (1, 6) s = s + n n = n + 1 print(s, n) Rewrite the...

  • please can you do all just true or false 15. Python interpreter cannot detect infinite loops....

    please can you do all just true or false 15. Python interpreter cannot detect infinite loops. 16. The opposite of 1 < x and x < 10 is 1 >= *OT =< x pue x 17. 3 // 5 == 0 is True. =D%3= 18. "New York" < "New Jersey" is True. 19. range (3, 8) generates the number sequence of [3, 4, 5, 6, 7]. 20. range (5) generates the number sequence of [1, 2, 3, 4, 5].

  • Using PYTHON (LOOPS, IF STATEMENTS ) I should write a function buckets that  takes two arguments: (bucketCount,...

    Using PYTHON (LOOPS, IF STATEMENTS ) I should write a function buckets that  takes two arguments: (bucketCount, an integer specifying the number of “buckets” to return and numberLs, a list of numbers ) buckets should split the range of values in numberLs into bucketCount sub-ranges. Specifically buckets should return a list-of-lists of length bucketCount. Each list in the returned list-of-lists represents a “bucket”. Each bucket should contain the numbers from numberLs whose values are greater than or equal to min(numberLs) +...

  • Task 4: for Loops (PROGRAM IS IN PYTHON) SHOW INPUT AND OUTPUT SCREEN SHOTS #!/usr/bin/python3 # ...

    Task 4: for Loops (PROGRAM IS IN PYTHON) SHOW INPUT AND OUTPUT SCREEN SHOTS #!/usr/bin/python3 # Measure some strings: words = ['cat', 'window', 'defenestrate'] for w in words: print(w, len(w)) #!/usr/bin/python3 # Measure some strings: words = ['cat', 'window', 'defenestrate'] for w in words: print(w, len(w)) forvar in list(range(5)): print (var) for letter in 'Python': # traversal of a string sequence print ('Current Letter :', letter) print() fruits = ['banana', 'apple', 'mango'] for fruit in fruits: # traversal of List...

  • USE THE PYTHON ONLY Sudoku Game Check Please write a Python program to check a Sudoku...

    USE THE PYTHON ONLY Sudoku Game Check Please write a Python program to check a Sudoku game and show its result in detail. This is an application program of using 2-dimensional arrays or lists. Each array or list is a game board of 9 x 9. Your program must check the 9 x 9 game board, and report all the problems among 9 rows, 9 columns, and 9 squares. As you can see, you must pre-load the following four games...

  • Starting out with Python 4th edition I need help with while loops I can't even get...

    Starting out with Python 4th edition I need help with while loops I can't even get one started correctly. Write a program a program that predicts the approximate size of a population of organisms. Problem 4.13 – population Use a while loop; there are no text boxes, just regular input statements Enter number of organisms: 2 Enter average daily increase: 30 Enter number of days to multiply: 10 DAY       APPROXIMATE POPULATION ------------------------------------------------- 1            2 2            2.600 3            3.380 4            4.394...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...

  • I'm working on a java program where I'm supposed to convert 4 bit binary into decimal....

    I'm working on a java program where I'm supposed to convert 4 bit binary into decimal. I went with if statements and tried to use an else to print out an error message if the user enters a number that isn't a binary number but it prints no matter what. (so, it prints that it's a vowel and that it's not a vowel) 1 import java.util.Scanner; 2 3 public class HomeworkTwoQ2 4 { 5 6 public static void main(String[] args)...

  • PLEASE USE WHILE LOOP (NOT FOR LOOPS). Python programming. In this problem, you should write one...

    PLEASE USE WHILE LOOP (NOT FOR LOOPS). Python programming. In this problem, you should write one function named multiply. This function should accept one parameter, which you can assume will be a list with one or more integers in it. (If you don’t know what I mean when I say “list of integers”, go do the reading!) The function should loop through all of the numbers in the list, and multiply all of the numbers together. It should return the...

  • Im getting the same output but I'm assuming I'm forgetting to incorporate the objective of evaluating...

    Im getting the same output but I'm assuming I'm forgetting to incorporate the objective of evaluating in increments of 1 unit? How do I code that? Instructions from your Teacher: run tests Write a program that prints to three significant figures the values of f(x) from x = 0 to x = 10 in increments of 1 unit. The values of x include 0 and 10. The function f(x) is defined below.. 1 import math 2 # funtion g(x) returns...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT