首页 > 其他分享 >DS2000 Every Vote Counts

DS2000 Every Vote Counts

时间:2024-09-19 17:45:51浏览次数:1  
标签:will DS2000 per your 2024 How Vote post Counts

DS2000 Fall 2024

Homework 1

Assigned: September 13, 2024

Deadline: September 20, 2024 at 9pm eastern

Submit each program as a .py file in gradescope (filenames are specified below). You may submit multiple times right up until the deadline.

You may submit up to 48 hours late for no penalty. This policy exists for those times you're having a tough week, are feeling sick, or are falling behind in your work; we won't make any exceptions to this policy.

You will have an opportunity at the end of the semester to submit one of homeworks 1-5 for a new grade. Your solution will be graded according to the DS2000 general rubric and style. guide.

You may not use conditionals or loops on this homework. The entire assignment can be accomplished with material we’ve covered in lecture.

Style. Guide Focus

(pay attention to these items in particular for this Homeworkbut the entire style guide will be used during gradingso please make sure you review it!)

● def main is used to organize code

● Constants are used for non-changing values; they are named in all caps and initialized above main

● Numerical values are not rounded during computation; they are rounded only for the user’s sake

The 30-minute Guideline

If you get stuck on a homework problem, come by office hours, post on Piazza, or take a break! We

recommend you spend about 30 minutes trying to figure out a problem -- enough time that you can try a few things to get unstuck, but not SO much time that you’re banging your head against the wall. Try for 30 minutes, then take a break, take a walk, and/or ask us. :)

Review the Autograder Output

When you submit your solution, gradescope will run your code and print out the results so you can see   what we’ll see when grading. Look at this output! It serves as a sanity-check to make sure your code    produces what you wanted; if it doesn’t, you can make revisions and resubmit up until the deadline. See the Gradescope FAQ to troubleshoot.

It’s fine to work with friends and share ideas with each other; it is not fine to share code. Do not show your code to classmates or post code on piazza.

Problem 1 - Every Vote Counts

Filenameelections.py

Prompt the user for, in this order:

● A U.S. state (a string).

●   How many people in this state voted in the November 2020 election? (This value should be an int and should not be abbreviated to thousands; find examples here.)

●   What percentage of the voting population does that represent? (This value should be a float in the range 0-100; find examples here.)

Using this information, compute and reportdai 写DS2000 Every Vote Counts the answers to the following questions. Round to a reasonable number of decimal places when reporting your results.

● How many people were eligible to vote in this state in 2020?

● How many people who were eligible to vote in 2020 did not?

●   It is hard to predict voter turnout in the coming election, but let’s say it decreases. If the number of 2020 voters in this state decreases by 3.2%, how many people will vote in this state in 2024?

●   There are 21,033 undergraduate students at Northeastern. If they all vote in this state in 2024, what percent of the vote would they collectively contribute?

For full credit under documentation, write a test case in a comment at the top ofyour file, something like this but with your own examples. Do this before you start coding so you know your program works! It's  okay if the format ofyour test case is different from your program's output.

 

Here’s an example of what happens when I run my program. (Your output doesn’t need to look exactly the same, but DO make sure your prompts are in the same order so that the autograder works):

 

Problem 2 - Olympic Year Filename: olympics.py

American runners Gabby Thomas (she/her), Nikki Hiltz (they/them), and Cole Hocker (he/him) all put on a great showing at the 2024 Olympic Games. Let’s figure out how fast they really are. :)

Prompt the user for, in this order:

● The name of an athlete (string).

● The distance of their race, in meters (int).

● Their time in the race, given in total seconds (float).

Using this information, compute and report the answers to the following questions:

● How many laps of the track was their race? (There are 400 meters per lap.)

● How many minutes and seconds was their race (note that minutes might be zero!)?

● What was their pace per lap, in minutes and seconds?

● What was their pace per mile, in minutes and seconds? (There are 1609 meters in a mile.)

For full credit under documentation, write two test cases in a comment at the top ofyour file, something  like this but with your own examples. Do this before you start coding so you know your program works!

 

Here’s an example of what happens when we run our program (yours doesn’t need to be exactly the same, but DO keep the prompts in the same order for the autograder):

 

Problem 3 - That Brand Life

Filename (code): influencer.py

Filenames (plot): influencer.png

Profs. Felix and Laney have decided to leave academia behind and become influencers on social media, under the brand FnL. They’ll be huge. In September 2024, FnL has 100 followers, but we expect a huge increase almost immediately. We assume that 5% of followers view any given post, 2.7% like it, and .97% comment on it.

The user for your Python program is a brand. Prompt the user for, in this order (all floats):

● How much will you pay per-view, for one post?

● How much will you pay per-like, for one post?

● How much will you pay per-comment, for one post?

Use the above information to compute (no need to print, except for testing!):

● How much money will one post generate for FnL, assuming we have 100 followers?

● How much money does one post generate, per follower?

● How many followers does FnL need to have to make $1,000 per post?

Create a scatterplot using plt.plot() where number of followers is on the x axis and per-post income is on the y axis. Your plot should have 4 separate points:

● Current per-post income for our starting point, September 2024 with 100 followers.

● Per-post income for October 2024, when our followers increase by 250%

● Per-post income for November 2024, when our followers increase by another 300%

● Per-post income when we reach our goal of $1,000 per post.

Save your plot as a .png file; do not submit screenshots. Make sure you review the style guide for the specific requirements that apply to all your plots in DS2000!

For full credit under the documentation category, write a test case in a comment at the top ofyour file,  like this but your own info. Do this before you start coding -- that way you know your program works!

 

标签:will,DS2000,per,your,2024,How,Vote,post,Counts
From: https://www.cnblogs.com/WX-codinghelp/p/18421066

相关文章

  • scanpy计算n_genes_by_counts和total_counts等质量控制指标
    利用scanpy计算adata的obs中的质量控制指标(n_genes_by_counts,total_counts等参数指标)⚠️注意:只是计算相关质量控制指标,并不会筛选/过滤数据。需要用的包:scanpy和anndata导入包和读取adata数据importanndataimportscanpyasscimportpandasaspdimportnumpyasnpa......
  • 高通pmic voter机制
    前不久在高通SDM450平台接触了voter机制(投票机制)。最近终于得空,结合一个问题简单研究了一下。现将研究流程简单记录一下,由于时间有限,所以是实用为目的,没有做详细的分析,不过结合着这篇分析和源码一起参考,应该能快速地应用voter做一些事情。voter=====第一步是找到voter的......
  • CodeForces 1132B Discounts
    题目链接:CodeForces1132B【Discounts】思路    因为使用coupons购买q[i]块巧克力,不需要付最便宜的那块巧克力的钱,所以为了使得优惠最大化,所以可以在使用优惠券的时候购买最贵的p[i]块巧克力,所以计算所有巧克力价格高之和和排序后很快能得到答案。代码#include<cst......
  • Vivotek CC8160 栈溢出漏洞复现
    漏洞文件https://github.com/Vu1nT0tal/IoT-vulhub/tree/master/VIVOTEK/remote_stack_overflow另需文件arml内核,文件系统,arm-gdbserver,initrd。https://people.debian.org/~aurel32/qemu/armel/启动qemu-systemqemu-system-arm-Mversatilepb-kernelvmlinuz-3.2.0-4-v......
  • 在 value_counts pandas 分类数据中包含零
    这是我之前提出的问题的后续问题。老问题可以在这里找到答案来自@jezrael现在我想绘制成绩。用于绘制我可以做的所有成绩但是,我无法弄清楚如何绘制每个成绩组(包括零计数)。counts_gardes=df1['new'].value_counts(sort=False)counts_gardes.......
  • AT_arc166_d [ARC166D] Interval Counts
    我们可以将题转化为选择若干区间,给区间中的每个\(y_i\)减一,这样我们就可以将问题转化为差分了。我们枚举区间的左端点,从左到右枚举,当我们枚举到\(i\)时,显然如果当前差分数组\(d_i>0\),那么我们需要将其减去\(d_i\),这样我们获得了一个向后加总共\(d_i\)个\(1\)的机会,此时......
  • [LeetCode] 1366. Rank Teams by Votes 通过投票对团队排名
    Inaspecialrankingsystem,eachvotergivesarankfromhighesttolowesttoallteamsparticipatinginthecompetition.Theorderingofteamsisdecidedbywhoreceivedthemostposition-onevotes.Iftwoormoreteamstieinthefirstposition,wecon......
  • CountSort
    有一种简单的排序算法叫作计数排序。这种算法对一个待排序表(用数组A[]表示)进行排序排序结果存储在另一个新的表中(用数组B[]表示),表中关键字为int型。必须注意的是,表中所有待排序的关键字互不相同,计数排序算法针对表中的每个关键字,扫描待排序表一趟,统计表中有多少个关键字比......
  • Oracle OCR,Vote disk故障恢复方案
     Oracle OCR,Votedisk故障恢复方案 1  概述OCR/Votedisk磁盘组故障场景恢复操作方案。测试版本:11.2.0.4.0适用于以下场景:操作维护OCR/Votedisk对应的磁盘组,提前备份了OCR文件信息,以便存在回退维护的空间。由于某些原因导致OCR/Votedisk的磁盘组丢失从而......
  • 2024-04-13:用go语言,给定一个整数数组 `nums`, 请编写一个函数,返回一个新的数组 `counts
    2024-04-13:用go语言,给定一个整数数组nums,请编写一个函数,返回一个新的数组counts。满足以下条件:对于每个nums[i],counts[i]表示在nums[i]右侧且比nums[i]小的元素数量。输入:nums=[5,2,6,1]。输出:[2,1,1,0]。答案2024-04-13:来自左程云。灵捷3.5大体过程如下:给定......