function 相关问题

函数(也称为过程,方法,子例程或例程)是用于执行单个特定任务的代码的一部分。将此标记用于特别涉及创建或调用函数的问题。有关实现执行任务的功能的帮助,请改为使用[algorithm]或任务特定的标记。

卡在 CS50 Python Week2 pset 问题“Vanity Plates” - 不确定我的代码出了什么问题

我今天刚刚开始使用CS50课程学习Python,在我进入第2周练习集后,我被这个问题“Vanity Plates”困住了。我之前没有编码背景...

回答 1 投票 0

PHP 中精确向上舍入和向下舍入分数的函数,有更好的方法吗?

我在 php.net 上找到了这段代码,它适用于我的 round_up 部分。 函数 round_up($值, $精度 = 0) { if (!empty($value)) { $符号 = (0 <= $value) ? +1 : -1; $amt = explode('...

回答 4 投票 0

登录错误:onLoginSuccess 不是函数

这是作者登录Web应用程序的组件 //作者登录 从 '@material-ui/core' 导入 { Button, CircularProgress, Fade, Link, TextField, Typography }; 导入 { 主题提供...

回答 1 投票 0

VBA。在 Select Case 过程中嵌套 if elseif

我在 VBA 模块中编写了以下函数作为测试用例。此时该功能仅包含一个“案例”,因为我想测试它,如果成功则填充更多...

回答 2 投票 0

我的数学函数返回 NaN

所以我一直要求更改我的代码以简化我的功能,但现在我已经简化了它们,它们现在只返回 NaN,我真的不明白为什么会这样,当输入是 num...

回答 1 投票 0

如何在Python中进行西格玛求和表示法?

如何将表达式作为参数传递给函数,然后在Python中执行它? def f(变量,函数): # 这里计算函数(未知部分) f(3, 2 * 变量) 结果

回答 1 投票 0

py lang 上的 SQL 函数,返回列

我需要一些帮助,我没有足够的知识。 我的问题是,如何从函数中进行选择,而无需像示例中那样编写每一列,是否有任何解决方案可以只编写简短的se...

回答 1 投票 0

尝试将 python matplotlib 绘图插入到 Word 文档表中

我的模块创建一个Word文档,然后在文档中创建一个3列的表格。然后,该模块调用另一个模块中的函数,该函数从随机创建的顶点生成梯形

回答 1 投票 0

浮点除以零误差,函数告诉一个数除以另一个数的最大幂

我正在用Python编写一个函数,它告诉我们一个数字除另一个数字的最大幂。我在第 9 行不断收到 ZeroDivisionError: float Floor 除以零。我不确定...

回答 2 投票 0

如何根据时间戳范围和平均组大小最大化对数据帧中的行进行分组?

我有一个数据框: prod_id 时间戳1 时间戳2 1 2023-12-02 2023-12-01 2 2023-12-05 ...

回答 1 投票 0

一个 Java 功能在另一个功能启动后无法激活

我对编码非常陌生。我正在尝试创建一系列夏威夷地图,当您选择带有日期的按钮时,政治边界会发生变化。我正在通过使用 javascript 来更改 im 来做到这一点...

回答 1 投票 0

当我尝试在Python中计算翻译语言(泰米尔语)的字符串时,它没有给我正确的计数,为什么?

代码 我尝试使用长度函数计算名称“KUMAR”的字符串,输出为 5,它是正确的。 但是当我尝试用不同的语言(泰米尔语)计算相同的名字时,我期望的输出......

回答 1 投票 0

为什么我的高阶函数返回 true 和 false?

我必须创建自己的高阶 filter() 函数来过滤 10 个单词的数组,该数组仅返回具有 6 个或更多字母的单词,但我的函数仅返回 true 和 false 而不是 omi...

回答 1 投票 0

当我尝试在Python中计算翻译语言(泰米尔语)的字符串时,它没有给我正确的计数,为什么?

代码 我尝试使用长度函数计算名称“KUMAR”的字符串,输出为 5,它是正确的。 但是当我尝试用不同的语言(泰米尔语)计算相同的名字时,我期望的输出......

回答 1 投票 0

当我在函数中定义变量名称时,为什么会收到 NameError 错误? [重复]

当我尝试运行此代码时,if 语句处出现 NameError,告诉我 net_affect 未定义。 h, m, s, t = input('对以下每种情绪进行评分并按 Enter 键: 幸福 (1-...

回答 1 投票 0

如何在react JS中使用map函数?我无法使用映射函数来运行循环来循环组件代码。我怎样才能运行它?

App.js具体代码: {blog.map((v, i) => ( ))} App.js具体代码: <Container> <Row> {blog.map((v, i) => ( <ProductItems key={i} blog={v}/> ))} </Row> </Container> function ProductItems() { return ( <Col lg="3" md="6"> <Card > <Card.Img variant="top" src="placeholder.js/100px180" /> <Card.Body> <Card.Title>Card Title</Card.Title> <Card.Text> Some quick example text to build on the card title and make up the bulk of the card's content. </Card.Text> <Button variant="primary">Go somewhere</Button> </Card.Body> </Card> </Col> ); } blog.jsx代码: export let blog = [ { "blog": [ { "userId": 1, "id": 1, "title": "are or do repels provide blacked out to accept the option criticizes", "body": "because and accepts\naccepts the result of refusal convenient and when which is all\nof our things, but they are the thing that will happen to the architect" }, { "userId": 1, "id": 2, "title": "who is to be", "body": "is of things at the time of life\nthey are nothing to follow let the pain of the blessed rebuke those pains and not run away from the caresses of the pleasure, nor any trouble" }, { "userId": 1, "id": 3, "title": "who is to be", "body": "is of things at the time of life\nthey are nothing to follow let the pain of the blessed rebuke those pains and not run away from the caresses of the pleasure, nor any trouble" }, { "userId": 1, "id": 4, "title": "who is to be", "body": "is of things at the time of life\nthey are nothing to follow let the pain of the blessed rebuke those pains and not run away from the caresses of the pleasure, nor any trouble" }, { "userId": 1, "id": 5, "title": "who is to be", "body": "is of things at the time of life\nthey are nothing to follow let the pain of the blessed rebuke those pains and not run away from the caresses of the pleasure, nor any trouble" }, { "userId": 1, "id": 6, "title": "who is to be", "body": "is of things at the time of life\nthey are nothing to follow let the pain of the blessed rebuke those pains and not run away from the caresses of the pleasure, nor any trouble" } ] } ] {描述:blog.jsx 包含 json 代码和我尝试通过地图函数循环的对象。 App.js 文件包含 ProductItems 组件和函数以及映射函数。} 我尝试重复 ProductItems 代码,因为它有卡代码。并期待这个结果并没有发生。 更正您的对象声明。你添加了一些不必要的东西。 代替: export let blog = [{ "blog": [....] }] 应该是: export let blog = [{ "userId": 1, "id": 1, "title": "...", "body": "...." }]; 为了你的对象 blog[0]?.blog?.map((blog)=>{ return <ProductItems key={blog?.id} blog={blog}/> }) 这会起作用

回答 1 投票 0

如何允许用户输入字典中包含的特定项目的多个数字

在计算机科学入门课程中,这是非常基本的代码,应该保持不变。我的任务是创建一台具有各种功能的自动售货机,其中我所坚持的两个自动售货机允许......

回答 1 投票 0

C 中的删除函数出现问题:“找不到数据”错误

C语言代码 *我的半代码无法正常运行,特别是删除函数,该函数应该从文件中删除信息,但它显示“未找到数据”。 我试着问一些...

回答 1 投票 0

我走在正确的道路上吗?剪刀石头布(Javascript)

我是 JavaScript 的初学者,目前正在从事 Odin 项目的剪刀石头布项目: 您的游戏将与计算机对战,因此从函数 c...

回答 2 投票 0

Python 中数字海洋函数的可重用实用方法

我希望能够跨多个 Digital Ocean Functions(他们的无服务器工具)重复使用代码。如果可以避免的话,我不想发布一个库。 我尝试了几种方法,...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.