80 likes | 106 Views
More Nested Loops and Lab 5. Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg. Announcements. UNI Computer Club Meeting is today! PA 4 is available Before starting, read Chapter 3.1-3.5!!!!! Discusses tools for program development Very important chapter!!. Yesterday’s Lab.
E N D
More Nested Loops and Lab 5 Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
Announcements • UNI Computer Club Meeting is today! • PA 4 is available • Before starting, read Chapter 3.1-3.5!!!!! • Discusses tools for program development • Very important chapter!!
Yesterday’s Lab • Activity A • New ways to print on the same line • What gave you the most trouble in Activity B? • How did you address this? • What gave you the most trouble in Activity C?
New ways to print # Playing with print endings x = 0 while x<10: print(x, end=‘ ’) x=x+1 print() print(“Final value of x is”,x)
What code could we write to print: * * * * * * * * * * * * * * *
Important things • Name your variables descriptive names! • x, y, z, a, b, c don’t make much sense with nested loops • Once you figure out what you need to do, write a detailed comment about it • Start by solving a small problem, then work up to larger problems • If all else fails, step through the program line by line
Activity B • Here is where we worked through the single line summation problem
Activity C • Here is where we worked through the multiple line summation problem (nested loop)