网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
02月08日漏签0天
python吧 关注:481,296贴子:1,984,395
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 5回复贴,共1页
<<返回python吧
>0< 加载中...

【求助】求大神帮忙python的作业

  • 取消只看楼主
  • 收藏

  • 回复
  • 什果麥麥
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
求各位大神帮忙,本人电脑白痴一枚,更别提编程了。
光是CPU和RAM就花了2天才弄明白是什么东西..
废话不多说..
我要用python写作业,
第一份,
要用pickAFile选择文件,然后可以辨别文件是不是图片(jpg格式)或者用makeSound选择辨别是不是wav格式的声音。
如果两者皆不是又要辨别出是哪一种文件格式。如果文件名字有错误(比如果说1234jpg,漏了点要有信息提示说有错误)
最后教授还提到什么rfind的东西,还有什么是len function
这是教授给的结果:
>>> openSoundOrPicture()
Oops! Did not choose a picture or a sound file.
Type is: html
第二份

我连要求都看不懂他要我干嘛...
先求大神们帮帮我吧~~~


  • 什果麥麥
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
作业题目原文,我解释的还行吧..
A fairly simple function is required that will obtain a file name (using pickAFile), and then recognise if it is a picture or a sound file, or even some other file type. The file should then be interpreted as either a picture—if of type jpg (then call makePicture, display the picture then exit) or a sound—if of type wav (then call makeSound, play the sound then exit) and if it is neither a picture nor a sound file, then an error message must be printed. This error message should include the type of the file (or the lack of a type, e.g. a file name that might not have a period in it, e.g.ducksjpg). Remember that file types can be 2, 3, 4 or even more letters long! The rfind method (see page 250) is useful here, as is the lenfunction. Don't open any files using file.open!
Typical output for attempting to access a file of type 'html' would be:
>>> openSoundOrPicture()
Oops! Did not choose a picture or a sound file.
Type is: html
NOTE: For submission, demonstrate your function by attempting to open a file of type 'html', and capture the output.


2026-02-08 16:41:45
广告
不感兴趣
开通SVIP免广告
  • 什果麥麥
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
第二份题目:
(请容我慢慢的看题目)
We will build on the functions provided to you in Lab 6. What is needed is a program that will attempt to smooth out the random noise present in a noisy sound file firstly by averaging two consecutive samples and then secondly by averaging three consecutive samples.
Write a program that will:
Using the functions from Lab 6, create a noisy sound by adding random noise to this sound file, but implement appropriate changes so that the given functions can be called by a main or calling program.
In the main program, adjust this noisy sound by creating a new current value, for each sample, based on the average of the previous sample and the current sample. The first sample can be averaged with an initial value of 0 for the "previous sample."
Now adjust the the same original noisy sound in part 1 by creating a new current value, for each sample, based on the average of the previoustwo samples and the current sample.The first sample can be averaged with an initial value of 0 for both the "previous samples."
In order to 'see' the sounds produced, invoke the function openSoundTool(sound) three times within your program, displaying the original noisy sound, then the smoothed sound from 2., and then finally the smoothed sound from 3. (There is no need to return any sound from the main/calling program.) For interest, here is a picture of the three windows, but tiled for convenience. Please press the 'Zoom In' button on each Sound Tool window, and ensure that the index is at 1 before copying the window, as this makes it easier to mark!
For submission, a single execution of your program could be:
>>> smoothSound(file, 2500)
where 'file' is the same sound file used in the lab 6, and the value of 2500 is the maximum amplitude for the added noise. For your submission, capture the output (Zoomed in, index at 1), in order, of the three invocations of the Sound Tool.


  • 什果麥麥
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

不知道这两张图片有没有帮助..




  • 什果麥麥
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
LL真心束手无策了,才来求各位大神帮忙的..
学校骗人!明明说好学这课不需要任何的电脑背景的!可是望眼过去一个个都是主修电脑编程的!
这让主修会计的我情何以堪啊!


  • 什果麥麥
  • 白丁
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
顶顶上去上去~~~


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 5回复贴,共1页
<<返回python吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示