Computer Science, asked by unboxingtime1234, 4 months ago

Write a program to create a tuple containing squares of integers 1 through 50 using a
for loop:

Answers

Answered by allysia
12

Answer:

The program in python does like:

__________________________

a=[]

for i in range(1,51):

   a.append(i**2)

print(tuple(a))

___________________________

Consider the image if you're having problem viewing this code.

Explanation:

Since you can't append values in tuples, I used a list and then converted it to a tuple before printing.

Attachments:
Answered by jai696
4

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

t = tuple()

for x in range(1, 51): t = (*t, x * x)

print(t)

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions