HW_2_ITM200_Solution (1).pdf

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Full Transcript

IMT200 Data Variables and Calculations #Homework:1-Solutions 1. Write a Python program called "Area_Calculation.py" to compute the area of a rectangle based on user input. The program should perform the following tasks: a) Prompt the user to enter the width and height of...

IMT200 Data Variables and Calculations #Homework:1-Solutions 1. Write a Python program called "Area_Calculation.py" to compute the area of a rectangle based on user input. The program should perform the following tasks: a) Prompt the user to enter the width and height of the rectangle, each on a new line b) calculate the area of the rectangle using the formula: area = width * height. 2. Write a program is called “NextTenMultiples.py” that reads a number from the input and prints the next 10 multiples that are greater than the input number. For example, if the input number is 11, the program should print 20. If the input number is 40, the program should print 50. 3. Write a Python program called "CharacterArithmetic.py" that performs the following tasks: a) Prompt the user to enter a single uppercase letter. b) Convert the uppercase letter to lowercase. c) Calculate the ASCII value of the lowercase letter and store it in a variable. d) Add 10 to the ASCII value and store the result in a new variable. e) Subtract 5 from the ASCII value and store the result in another variable. IMT200 Data Variables and Calculations #Homework:1-Solutions f) Convert the final ASCII value back to a character. g) Print the final character.

Use Quizgecko on...
Browser
Browser