Part 1 simple functions 1 9 points write a python

• 3
• 100% (2) 2 out of 2 people found this document helpful

This preview shows page 1 - 3 out of 3 pages.

Part 1 - Simple Functions 1. [9 points] Write a Python function that will generate the following triangle shape. 2. [10 points] Write a Python function ‘ sortThree ’ to prompt the user to enter three integers. Your function will respond with the three numbers sorted in ascending numerical order. For example: 1 | am/cpsc111-W19-Asg2.docx Assigned: Sunday Feb. 3 rd , 2019
CPSC111-Introduction to computing By Dr. Ahmed Malki – Asg. #2 (Winter-19) >>> Please type in three integers 11 12 3 3 11 12 >>> Please type in three integers 9 6 15 6 9 15 3. [15 points] Use for loops, whenever possible, to make a turtle draw these shapes on the same line. [15 points, 3 points each] Part 2 – Written [16 points, 2 points each] 1. Convert the following binary numbers into decimal, assuming they are unsigned integers . Show the calculation you did to get the decimal values. a. 1110 b. 10111111 c. 10101110 2. Convert the following binary numbers into decimal, assuming they are signed integers . Show the calculation you did to get the decimal values. a. 111101 b. 01010111 3. Convert the following binary numbers into decimal, assuming they are two's complement values . Show the calculations you did to get the decimal value. a. 1011 2 | am/cpsc111-W19-Asg2.docx Assigned: Sunday Feb. 3 rd , 2019
CPSC111-Introduction to computing By Dr. Ahmed Malki – Asg. #2 (Winter-19) b. 11011101 c. 01011 Check the handout on different conversion systems (Two's Complement to Decimal Conversion) on Canvas Happy computing!
• • • 