CS 100 2016F Homework 03 Due: at the beginning of the next class. Read Chapter 3, Sections 3.1 and 3.2, and Chapter 5, section 5.1. Work the Practice Problems on these pages and compare your solutions to the Solutions to Practice Problems at the end of the chapter. Do the programming assignment below. If you run into a problem, post to Moodle describing where you ran into trouble or email your instructor or classroom assistant, or ask your question during office hours. If you know the answer to someone’s question on Moodle, post a response. You get course credit for asking and answering questions in Moodle. Submit a text file with the extension with your answers to the assigned exercises below via ‘.py’ Moodle. Python code that does the following: i. Assigns the values 3, 4 and 5 to the variables a, b and c, respectively. ii. Write an if statement that prints if a is less than b ‘OK’ iii. Write an if statement that prints if c is less than b ‘OK’ iv. Write an if statement that prints if the sum of a and b is equal to c ‘OK’ v. Write an if statement that prints if the sum of a squared and b squared equals c ‘OK’ squared. Repeat the previous problem with the additional requirement that OK’ is printed if the ‘NOT condition is false. 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 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 what color? blue what line width? 25 what line length? 100 line, triangle or square? triangle the following would be correct graphical output
CS 100 2016F Homework 03 Due: at the beginning of the next class. Read Chapter 3, Sections 3.1 and 3.2, and Chapter 5, section 5.1. Work the Practice Problems on these pages and compare your solutions to the Solutions to Practice Problems at the end of the chapter. Do the programming assignment below. If you run into a problem, post to Moodle describing where you ran into trouble or email your instructor or classroom assistant, or ask your question during office hours. If you know the answer to someone’s question on Moodle, post a response. You get course credit for asking and answering questions in Moodle. Submit a text file with the extension ‘.py’ with your answers to the assigned exercises below via Moodle. Python code that does the following: i. Assigns the values 3, 4 and 5 to the variables a, b and c, respectively. ii. Write an if statement that prints ‘OK’ if a is less than b iii. Write an if statement that prints ‘OK’ if c is less than b iv. Write an if statement that prints ‘OK’ if the sum of a and b is equal to c v. Write an if statement that prints ‘OK’ if the sum of a squared and b squared equals c squared. Repeat the previous problem with the additional requirement that ‘NOT OK’ is printed if the condition is false. 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 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 what color? blue what line width? 25 what line length? 100 line, triangle or square? triangle the following would be correct graphical output