Mar-28-2018, 09:05 PM
def create_multiplcation_table(width, height):
output = ""
num_chars = len(str(width*height)) + 1
for a in range(1, height+1):
for b in range(1, width+1):
product = a * b
product_str = str(product)
product_str = product_str.rjust(num_chars, " ")
output += product_str + " "
output += "\n\n"
return ouput
def process_input(raw_input):
try:
value = int(raw_input)
except ValueError:
raise ValueError("%s is not an integer" % raw_input)
if value <= 0:
raise ValueError("All dimensions must be greater than zero.")
return value
def get_user_input():
values = []
for prompt in ('Width', 'Height'):
raw_input = input(prompt + ": ")
processed_input = process_input(raw_input)
values.append(processed_input)
return values
def main():
success = False
try:
width, height = get_user_input()
success = True
except Exception as e:
print(e)
except KeyboardInterrupt:
print("\nGoodbye.")
if success:
ouput = create_multiplcation_table(width, height)
print('\n\n' + output)
if __name__ == '__name__':
main()I run this and absolutely nothing happens. This is a video tutorial. I've gone over the code and compared it with the video and I don't see a difference. Any help will be most appreciated!
Thanks!
Tonya

![[Image: qcWX53.jpg]](https://imagizer.imageshack.com/v2/xq90/923/qcWX53.jpg)