Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Only Do all of the items below and submit a text file created with the IDLE editor (or other editor) with the extension .py

Python Only image text in transcribed
Do all of the items below and submit a text file created with the IDLE editor (or other editor) with the extension .py via Canvas. If you run into a problem, post to Canvas describing where you ran into trouble or email your instructor or classroom assistant, or ask your question during recitation hours. If you know the answer to someone's question on Canvas, post a response. You get course credit for asking and answering questions in Canvas. Read Chapter 5 (Conditionals and Recursion) in the textbook. You may skip the following sections: Recursion, Stack Diagrams for Recursive Functions, and Infinite Recursion. In the Python editor IDLE, create and save a Python file that is named, if your name is Harry Houdini, for example, HW4_HarryHoudini.py and begins with a comment containing your name, class and section, the posting date and number of the homework assignment. 1. Write Python code that does the following: a. Assigns the values 3, 4 and 5 to the variables a, b and c, respectively. b. Write an if statement that prints "OK" ifa is less than b c. Write an if statement that prints "OK" if c is less than b d. Write an if statement that prints "OK" if the sum of a and bis equal toc e. Write an if statement that prints "OK" if the sum of a squared and b squared equals c squared. 2. Repeat the previous problem with the additional requirement that "NOT OK" is printed if the condition is false. 3. Write a program that asks the user for a color, a line width, a line length and a shape. Assume that the user will specify a shape that is either a line, a triangle, or a square. Use turtle graphics to draw the shape that the user requests of the size, color, line width and line length that the user requests. For example, if these are the user choices for color, width, line length and shape, the blue triangle below would be correct graphical output what color? blue what line width? 25 what line length? 100 line, triangle or square? triangle

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

=+2 How can the effectiveness of global virtual teams be improved?

Answered: 1 week ago

Question

=+1 What are the major issues related to international T&D?

Answered: 1 week ago