# 01-Variables, assignment and operator precedence

AI悦创原创python 1v1留学生作业辅导剑桥大学大约 3 分钟...约 898 字

## # Exercise 01.1

EN

Degrees Fahrenheit ($T_F$) are converted to degrees Celsius ($T_c$) using the formula:

$T_c = 5(T_f - 32)/9$

Write a program to convert 46 degrees Fahrenheit to degrees Celsius and print the result.
Write your program such that you can easily change the temperature in Fahrenheit that you are converting from.

Use the variable name T_c for the temperature in degrees Celsius.

T_f = 46
...

## test ##
import math
assert math.isclose(T_c, 7.77777777777777)


## # Exercise 01.2

EN

You have been tasked with developing a mortgage affordability test tool. A component is to compute the monthly
interest payments for a range of scenarios.

Interest on a particular mortgage is charged at fixed rate above the Bank of England (BoE) 'official Bank Rate'.
Interest is computed per annum, and interest payments spread equally over each month of the year.
Write a program that computes the interest payable each month, with variables for:

1. Loan principal (amount borrowed, fixed)
2. Official Bank Rate (percentage, expressed per annum)
3. Rate over the official Bank Rate (percentage, expressed per annum)

Test your program with a loan principal of £172,000, BoE rate of 2.25%, and rate over the
BoE rate of 1.49%. Use the variable name interest for the monthly interest amount.

AI悦创·编程一对一

AI悦创·推出辅导班啦，包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」，全部都是一对一教学：一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然，还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线，随时响应！微信：Jiabcdefh

C++ 信息奥赛题解，长期更新！长期招收一对一中小学信息奥赛集训，莆田、厦门地区有机会线下上门，其他地区线上。微信：Jiabcdefh

• 0
• 0
• 0
• 0
• 0
• 0

• 按正序
• 按倒序
• 按热度