我每次提交时都会在edX.org上的Python课程中得到11或12个正确,但是在讨论中没有得到任何人的帮助,因为没有人可以在那里发布任何代码(没有真正有用)并且没有似乎是任何可用的支持人员从课程中说话,我会付钱,所以我在这里发帖.我正要付钱给某人来指导我,但现在没有人可以使用,而且我有一些压力要在12月之前为我的工作完成这门课程.
这是作业:
现在编写一个程序,计算所需的最低固定月付款,以便在12个月内偿还信用卡余额.按固定的每月付款,我们指的是每个月不变的单个数字,而是每月支付的固定金额.
在这个问题上,我们不会处理最低月付款率.
以下变量包含如下所述的值:
余额 - 信用卡上的未结余额
annualInterestRate - 年度利率小数
该计划应打印出一行:每月最低付款,以偿还1年内的所有债务,例如:
最低付款:180
假设利息按月末的余额(在该月的付款之后)按月复利.每月付款必须是10美元的倍数,并且所有月份都相同.请注意,使用此付款方案可能会使余额变为负数,这是可以的.所需数学的摘要如下:每月利率=(年利率)/ 12.0
每月未付余额=(以前的余额) - (每月最低固定付款额)每月
更新余额=(每月未付余额)+(每月利率x每月未付余额)
这是我的代码:
#! /usr/bin/python3.6
from math import ceil
def roundup(x):
return int(ceil(x / 10.0) * 10)
def getFixedPayment(balance,annualInterestRate,counter=12):
totalLoan = balance + (balance*annualInterestRate)
monthlyPayment = roundup(totalLoan/12.0)
newBalance = totalLoan - monthlyPayment
if counter < 12:
newPayment = newBalance / counter + 1
else:
newPayment = newBalance / counter
if counter == 1:
return roundup(newPayment/12)
else:
return getFixedPayment(balance,annualInterestRate,counter-1)
#balance = 3329
#annualInterestRate …Run Code Online (Sandbox Code Playgroud) 我发现我喜欢名为“Dell Command | Update”的命令行工具dcu-cli.exe。我可以在远程会话中运行它,以管理员身份运行 CMD,将它推送到包含它及其依赖项的目录,并且它运行良好。但是,但希望能够使用 psexec.exe 执行此操作,因为 PowerShell 远程处理在网络中暂时被禁用。
当我用 psexec.exe 运行它时,我得到:
Unhandled Exception:
J:\CommandUpdate>System.IO.IOException: The handle is invalid.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
at Dell.CommandUpdate.CLI.Program.ShowWorking()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Run Code Online (Sandbox Code Playgroud)
运行 psexec 时,我通常是这样运行的:
psexec.exe -s \\computer -nobanner cmd.exe /c "pushd \\path\to\CommandUpdate && dcu-cli.exe"
psexec将在cmd.exefor …
我正在按照C#Tutorial视频中的说明进行操作.我正在使用视频中的注释和代码构建一个文件.
我审查了类似的问题,但他们没有解决这个问题.
这是CS文件的副本:
static void Main(string[] args)
{
// Single line comments
/* test multi-line comments
* asldkjasldkjaskd
* asldkjasldkja
* alsdkjalksdj
* */
Console.WriteLine("Hello world!");
Console.Write("What is your name? ");
string name = Console.ReadLine();
Console.WriteLine("Hello " + name);
bool canVote = true;
char grade = 'A';
// Integer with a max number of 2,147,483,647
int maxInt = int.MaxValue;
//Long with max value of 9,223,372,036,854,775,807
long maxLong = long.MaxValue;
// Decimal has a max value of 79,228,162,514,264,337,593,543,950,335
// If you …Run Code Online (Sandbox Code Playgroud)