Devry CIS 115 Week 4 iLab and Course Project
Complex and Nested Statements and Debugging
CIS115 Week 4 Lab Overview
Title of Lab: Multiplication Table in Python
This week’s lab is to create a simple multiplication table using nested loops and if statements.
Prompt the user for the size of the multiplication table (from 2×2 to 10×10). Use a validation loop to display a warning if the number is less than 2 or greater than 10 and prompt the user to enter the data again until they enter a valid number.
Put a # after any even number in your table (odd numbers will have just a space/nothing after them).
- A source code Python file.
- A Word document containing both source code and the screen print of the program outputs.
Wait.... Hire Me To Get 100% Original Help In . With No Upfront Fees. Watch The Video Below For More Information & How It Works!
Name: Jennifer Lucas
Status: Online ⬤
Classes Taken: 3878
The output should be something similar to the following.
- The outer loop will start each new row.
- The inner loop will control the display of each column in the row.
- Note that to keep the numbers right-aligned, there are different amounts of space before single-digit numbers (those less than 10), double-digit numbers (those between 10-99), and triple-digit numbers (100).
- The row labels can be added to your inner loop (note that there are different amounts of space required after the number in the row labels.
- The column labels should use a separate loop(s) that run before the main outer loop.
- You can continue printing on the same line using end=”” in your print statement. This will come in handy if you want to print several things on one line inside a loop. For example, assuming the value of name is Ada, the following will print “Hello Ada” on one line:
print(“hello “, end=””)
- Start early!
- Do the basic table first without worrying about the spacing or lining things up, and don’t include row or column headings (add those later).
- Once you get the numbers in the correct position, think about adding the proper amount of space before each number to line things up.
- Once the columns line up, add the #/space for even/odd numbers.
- Once the basic table is working, then add the row and column headings, and finally the main title.
- Test as you go!
CIS 115 Week 4: Course Project
The Week 4 portion of your Course Project is due this week. Please refer to the Course Project Overview in the Introduction and Resources module for full details. Use this report (Links to an external site.) to complete this portion of the project.
Guess the number!
You will create a program that will ask the user to guess a number between 1 and 10. The pseudocode is below. Be sure to import random at the beginning of your code and use a comment block explaining what your program does
#Guess the number week 4 #Name: #Date: #Random number, loop while true #ask user for number. #if number is too high or too low, tell user, if they guessed it break out of loop Display "Welcome to my Guess the number program!" random mynumber while True Display "Guess a number between 1 and 10" Get guess if (guess<mynumber) Display "Too low" else if (guess>mynumber) Display "Too high" else if (guess==mynumber) Display "You guessed it!"
When you run your program the result should be something like this:
Welcome to my Guess the number program! Please guess a number between 1 and 10: 5 Too high Please guess a number between 1 and 10: 4 Too high Please guess a number between 1 and 10: 3 Too high Please guess a number between 1 and 10: 2 You guessed it!
Be sure to submit your assignment.