""" CSC 15 Lab 3 Due before next week's lab PLEASE SUBMIT ALL PARTS OF ASSIGNMENT IN ONE FILE ------------------------------------------------------------------------ """ # PART I: Basic Drills # 0. Given: x = int(input("Enter an integer: ")) # Write a boolen condition to determine if x is a positive even integer. # Note that this rules out zero, which is not positive. Write an # if statement that prints whether or not x is a positive even integer: # I'll do this one for you: if (x>0 and x%2==0): print("x is a positive even integer") else: print("x is not a positive even integer") # 1. y = int(input("Enter another integer: ")) # Write code to determine, and print out, whether x (from above) is equal to, # less than or greater than y. You code need to print one of three # possibilities. # 2. Two integers are "relatively prime" if neither divides the other evenly # (without leaving a remainder). For example, 4 and 6 are relatively prime # because neither can divide the other. But 4 and 8 are not relatively prime # because 8 divides 4 evenly (8%4=0). Write an if statement to determine # x and y entered above are relatively prime. # 3. z = int(input("Enter an integer that's different from x and y: ")) # Write a boolean condition to determine if z is either the same as x or # the same as y. # 3b. Use a while loop around the above input so that the loop terminates # only when a different integer is entered. For example, if x,y==2,5 above, # then the program should behave like the following: # Enter an integer that's different from x and y: 2 # Enter an integer that's different from x and y: 5 # Enter an integer that's different from x and y: 2 # Enter an integer that's different from x and y: 8 # Thank you! # Hint: think in terms of what should be in the preamble of the loop # and what should be in the postamble. The "Thank you!" should be # printed after the loop finishes. # 4. Use (possibly several) if/else/elif statements to print the SMALLEST # of the three number that was entered. # Hint: the answer (for finding the largest) was demonstrated in class. # You shouldn't need more than two independent if statements. First set # a variable sm to x, then test if y is smaller than sm, then test if # z is smaller than sm: sm = x if y