Answered step by step
Verified Expert Solution
Question
1 Approved Answer
mystery _ int = 5 #You may modify the lines of code above, but don't move them! #When you Submit your code, we'll change these
mysteryint
#You may modify the lines of code above, but don't move them!
#When you Submit your code, we'll change these lines to
#assign different values to the variables.
#This is a tough one! Stick with it you can do it
#
#Write a program that will print the times table for the
#value given by mysteryint. The times table should print a
#twocolumn table of the products of every combination of
#two numbers from through mysteryint. Separate consecutive
#numbers with either spaces or tabs whichever you prefer.
#
#For example, if mysteryint is this could print:
#
#
#
#
#
#
#
#To do this, you'll want to use two nested for loops; the
#first one will print rows, and the second will print columns
#within each row.
#
#Hint: How can you print the numbers across the row without
#starting a new line each time? With what you know now, you
#could build the string for the row, but only print it once
#you've finished the row. There are other ways, but that's
#how to do it using only what we've covered so far.
#
#Hint : To insert a tab into a string, use the character
#sequence t For example, t will print as
#
#Hint : Need to just start a new line without printing
#anything else? Just call print with no arguments in the
#parentheses.
#
#Hint : If you're stuck, try first just printing out all
#the products in one flat list, each on its own line. Once
#that's working, then worry about how to organize it into
#a table.
#Add your code here!
for i in range mysteryint:
rowstring
for j in range mysteryint:
product i j
rowstring strproductt
printrowstring
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started