CMPT 120 Study Guide - Final Guide: Multiplication Table
meghan78 and 39786 others unlocked
29
CMPT 120 Full Course Notes
Verified Note
29 documents
Document Summary
Final study questions part 4 for loop: multiplication table. #get the input from the user num = int(input("please enter a number: ")) #display the multiplication table for the number inputted by the user for value in range(1,11): print(num, "x", value, "=", num*value) while loop: multiplication table. #ask the user for the input user_input = int(input("please enter a number: ")) #create a list of numbers num_list = [1,2,3,4,5,6,7,8,9,10] #create a variable and initialize it index = 0. #display multiplication table while index < len(num_list): print(user_input, "x", num_list[index], "=", user_input*num_list[index]) index = index + 1. Compute 1"s complement binary addition for the following problem: 23 express in 8 bit binary: 00010111 flip bits: 11101000 add 1: 11101001. Read text file and print words with over 20 characters. #open and read file outputfile = "words. txt" filer = open(outputfile, "r") #print words with more than 20 characters for line in filer: word = line. strip() if len(word) > 20: print(word)