So I\'m currently doing coding in Python. There\'s two parts and we\'re supposed
ID: 3687910 • Letter: S
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=' ')
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 I'm Cortana. Ask me anythingExplanation / Answer
a)
for i in range(10):
for j in range(10):
print(j, end=' ')
print(" ")
b)
for i in range(10):
for j in range(10):
print(i, end=' ')
print(" ")
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.