Question

In Python what is the output? Instead of using newlines to separate, use comma to separate...

In Python what is the output? Instead of using newlines to separate, use comma to separate each line ie. (a,b,c,...)

for i in range(10, 1, -1):

print(i, end=",")

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Output is
10,9,8,7,6,5,4,3,2, 

Explanation

  • range(10, 1, -1) gives numbers from 9 through 2 because when 1 comes, it stops and each time decrements by 1 since the third parameter is -1
  • print(i, end=",") means to print i and at the end a comma must be there. So, after each and every number there is a comma
Add a comment
Know the answer?
Add Answer to:
In Python what is the output? Instead of using newlines to separate, use comma to separate...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Loop Prints hand traced in python. What is the output? Instead of using newlines to separate,...

    Loop Prints hand traced in python. What is the output? Instead of using newlines to separate, use comma to separate each line ie. (a,b,c,...) for i in range(1, 10): if i % 2 == 0: print(i, end=",")

  • What is the output of the following Python code if the user enters 4? count =...

    What is the output of the following Python code if the user enters 4? count = int(input()) the_sum = 0 for i in range (1, count):     the_sum = the_sum + i print("Sum is", the_sum)

  • I want this using while loop This using stringin python Use list or some thing in...

    I want this using while loop This using stringin python Use list or some thing in python Using list in python I want answer as soon as posdible E. Last Number time limit per test: 1 second memory limit per test: 256 megabytes input standard input output standard output You are given a sequence of positive integers aj, , 03, ... Print the last element of the sequence. Input The input consists of multiple lines. The i-th line contains a...

  • given code: assignment: use python to extend the given code to create an output similar to...

    given code: assignment: use python to extend the given code to create an output similar to the one in the black box please explain the final code import random HALMst N in = int(input('Enter Total Number of Cards: ") NM in NOON A = [] B [] E - [] D = [] E = [] for i in range(1, n+1): A.append(i) D.append(i) E.append(i) for j in range(n): 8.append(random.choice(D)) D.remove(B[5]) C.append(random.choice(E)) E.remove(C[j]) c= 0 for k in range(n): if (Brkl...cikl):...

  • python: how would I format the grid below so that it is aligned correctly? as you...

    python: how would I format the grid below so that it is aligned correctly? as you see, I tried to center it but it is still not correct. import random row=random.randint(1,10) col=random.randint(1,10) for r in range(row): for c in range(col): if r %2==0 and c %2==0: print(format('a','^3'),end=' ') elif r %2!=0 and c %2!=0: print(format("/x\\",'^3'),end=' ') elif c%2!=0: print(format('-','^3'),end='')    else: print(format('s','^3'),end=' ')    print() #go to next line current Output is: (example if random function choses col=4 and row=3)...

  • Iwant answer this using number. Airthemitics. Varibles by python This using if else in python The...

    Iwant answer this using number. Airthemitics. Varibles by python This using if else in python The third picture using if. Elif. Else This using for loop in python A. Perimeter of a Rectangle time limit per test 1 second memory limit per test: 256 megabytes input standard input output standard output You are given two positive integers a and b which are the sides of the rectangle. Print the perimeter of this rectangle. The formula for perimeter is P =...

  • Need in Python! Consider the following program and expected output. Rewrite it using a for loop...

    Need in Python! Consider the following program and expected output. Rewrite it using a for loop and a conditional break statement such that it has the same output.   HINT: Stay with i as the main loop counter and let j control the break behavior.   i = 0 while i < 10 and j < 10 : j = i * 2 print(i, j) i += 1 # Output below, for reference - not part of the program! 0 0 1...

  • I am using python and I want to know how I can get the spacing between...

    I am using python and I want to know how I can get the spacing between the low mid and high to be dependent on the range and how I can get that boarder to be dependent on the range as well. Im not sure what you mean, I just want to know about the spacing. Modify your project1.py Python program so that it displays the low, mid and high point values for periodic function and a double-line border. (HINT:...

  • 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...

  • python Show the output generated in python for the following cases: s1 "Mueller" s2- "Collusion" i)...

    python Show the output generated in python for the following cases: s1 "Mueller" s2- "Collusion" i) print( The winner is: "+ s2+'or" +s1) i) print( ( s1+ s2) * 2) ili) print(s11.3]) v) print(s112]+ s2 2]) v) print(s1[-1]+ s21-1]) vi) print(s2 upper) vii)for w in "Mississippi" split( ss) print( w end

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