Information Technology > Study Notes > ENGR112_HW3_Ifs_Loops_2 (All)
ENGR112_HW3_Ifs_Loops_2Week 3 Homework ENGR 112 Ifs and Loops Name: Guanyun Qiao Lab Time (ECampus write “ECampus”): W 1000 Names of people you worked with: • Websites you used: • Approx... imately how many hours did it take you to complete this assignment (to nearest whole number)? 8 By writing or typing your name below you affirm that all of the work contained herein is your own, and was not copied or copied and altered. Note: Failure to sign this page will result in a 50-point penalty. Failure to list people you worked with may result in no grade for this homework. Failure to fill out hours approximation will result in a 10-point penalty. Turn .zip files to Canvas or your assignment will not be gradedWeek 3 Homework ENGR 112 Ifs and Loops WARNING: For most of you this homework will be substantially more difficult than the previous two have been. Start early. Learning Objectives: You should… • Understand how to use for loops to avoid replicating code and for iterating over arrays. • Know how to use relational operators to ask questions like greater than/less than/the same about data. • Know how to use if statements to control program flow. Homework Guidelines: 1) Loops: a. You can start by manually writing the first step of the loop, then writing the second step. b. Once those steps work, put the for loop around the line(s) i. How many times should you loop? When should you stop? How do you have to change the line so that it works with the loop variable? c. You can also try downloading example scripts from online, choosing those closest to your desired script and editing them (understand them first). 2) If statements/relationals: a. Write it out in pseudo code first. 3) Indenting: a. Maintain correct indenting at all times – this will help you “see” your code structures and check if your ends are in the right place (see Lab 3 for more detail). b. You can use this green button to do it for you: 4) Debugging: a. Before running your code, put a break point at the first line of every for loop and in every if statement (click on the number on the left). Then you can “watch” to see if a) you go into the if statement when you expect to and b) if you are doing the right thing in your for loop. b. Put your cursor over the variables (eg, k, open etc) to see what values they take on. You can also check what they are by typin [Show More]
Last updated: 1 year ago
Preview 1 out of 15 pages
Connected school, study & course
About the document
Uploaded On
Sep 24, 2022
Number of pages
15
Written in
This document has been written for:
Uploaded
Sep 24, 2022
Downloads
0
Views
52
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·