首页 > 其他分享 >实验7

实验7

时间:2023-06-13 14:34:24浏览次数:42  
标签:task3 return lst 实验 func math

task3

import math
def func(x):
    f = ((math.e)**((-0.5)*(((x - m)/s)**2)))/(s*math.sqrt(2*(math.pi)))
    return f'{f:.8f}'

m = 0
s = 2
x_lst = [1, 3, 5, 7, 9]
for x in x_lst:
    print(f'x = {x}, f = {func(x)}')

 

标签:task3,return,lst,实验,func,math
From: https://www.cnblogs.com/heqifan666/p/17477417.html

相关文章

  • 实验七
    task4代码#include<stdio.h>#include<stdlib.h>#include<string.h>#defineN5#defineM80intmain(){charch[M];intch_counts=0,n=0;FILE*fp;fp=fopen("data4.txt","r");if(fp==NULL){......
  • Python实验课7
    实验任务1classAccount:'''一个模拟银行账户的简单类'''def__init__(self,name,account_number,initial_amount=10):'''构造新账户'''self._name=nameself._card_no=account_numb......
  • 实验六
    task1-11fromturtleimport*2defmove(x,y):3penup()4goto(x,y)5pendown()67defdraw(n,size=100):8foriinrange(n):9fd(size)10left(360/n)11defmain():12pensize(2)13pencolor('re......
  • 实验7 面向对象编程与内置模块
    实验任务1#task1源码1'''2银行账号3数据:持卡人姓名、账号、当前余额4操作:取款、存款、打印账户信息、返回账户余额5'''67classAccount:#一个模拟银行账户的简单类89def__init__(self,name,account_number,initial_amount=10):#构......
  • 实验七
    任务1classAccount:def__init__(self,name,account_number,initial_amount=10):self._name=nameself._card_no=account_numberself._balance=initial_amountdefdeposit(self,amount):self._balance+=amount......
  • 实验7
    任务1classAccount:def__init__(self,name,account_number,initial_amount=10):self._name=nameself._card_no=account_numberself._balance=initial_amountdefdeposit(self,amount):self._balance+=amount......
  • 实验7
    task4编程代码#include<stdio.h>#include<stdlib.h>intmain(){FILE*fp;intx=0;charch;if((fp=fopen("d:\\data4.txt","r"))==NULL){printf("Failtoinitialize\n");e......
  • 实验七
    TASK4#include<stdio.h>intmain(){charch;intcount=0;FILE*fp;fp=fopen("D:\data4.txt","r");if(fp==NULL){printf("failtoopenfile\n");......
  • 实验7
    task1.py1classAccount:2'''一个模拟银行账户的简单类'''3def__init__(self,name,account_number,initial_amount=10):4'''构造新账户'''5self._name=name6self._ca......
  • 实验7
    task1_1#include<stdio.h>#defineN7#defineM80typedefstruct{charname[M];charauthor[M];}Book;intmain(){Bookx[N]={{"《雕塑家》","斯科特·麦克劳德"},{"《灯塔》","克里斯多夫·夏布特"},......