Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab: Show the output that would be generated by each of the following program fragments. Make sure to put these statements inside def main() and
Lab:
Show the output that would be generated by each of the following program fragments.
Make sure to put these statements inside def main() and main() as a complete .py file, then run it.
Be very careful about the indentation.
1.
for i in range (1,10):
print (i*i)
2.
for i in [2, 4, 6, 8, 10]:
print (i, ":", i**3)
3.
x = 1
y = 9
for j in range (0, y, x):
print(j, end="")
print(x + y)
4.
result = 0
for i in range (1, 11):
result = result + i*i
print(i)
print (result)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started