04 Feb Tuesday 17:30 Python Homework 21.02.02.
You could create python file and Write program for the following questions, detailed instructions as below:
- Open Python IDLE
- In Menu Bar, Click “File” => “New File”
- In the file write your program
- After finishing writing the program, click “Run”=>”Run Module” in menu bar or just press “F5”
- Python will ask you save the file before run the program
- Check your code and fix the errors.
Write a program that asks for the dimensions (length and width) of a rectangular room, and then calculates and displays the total amount(area) of carpet needed to cover the room.
Use input() to ask question and get answer, however, you can only get string data type of answer. In order to get decimal number as dimensions, you need to use float(input(…..)) which will convert from string answer into a decimal number.
Use easygui we have learned in the class to create a window to ask your favorite ice-cream flavor. You can consider using easygui.buttonbox to create something like the following and use easygui.msgbox to display your choice.
Sorry, the comment form is closed at this time.