Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 2: For this part you will need to write a Python program, named squares py, that prints a list of the first six odd

image text in transcribed

Task 2: For this part you will need to write a Python program, named squares py, that prints a list of the first six odd positive integers and their squares. Your output should look similar to the one provided at the end of the description: Implement this code in steps: o Step1: Open IDLE, then from the menu choose File New File Save as... and o Step2: Write a while-loop that will repeat six times and the body of the loop will be printing one o Step3: update the previous loop so that it prints in each line, the number and the square of the use name squares.py. Make sure you save this file in "lab4" folder. positive integer in each line. number, e.g. 16 o Step4: Inside the body of the loop, include an if-statement to check if a number is odd (Hint: use the modulo (%) operation.) Since you only want to print only odd numbers (and their squares) in your final output, you should make sure that the printtaement from Step2, is part of the body of the if- statement. o Step5: Add another print statement BEFORE the loop, to print the 1 line shown in the final output shown below FINAL OUTPUT Number Square 25 49 81 121

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

Discuss the core competency: Utilize informatics.

Answered: 1 week ago