Find Jobs
Hire Freelancers

Python quiz to be completed ( code change from pascal to python)

$10-30 USD

Käynnissä
Julkaistu lähes 5 vuotta sitten

$10-30 USD

Maksettu toimituksen yhteydessä
Your program should use the Free Pascal compiler described in CSC 540. When you hand in your assignment to the digital dropbox, it should be a .PAS file, not zipped. Be careful to use qword instead of int variables for the appropriate declarations since some of these numbers may be over 32,767 (the limit of a Pascal int). Also, while you are debugging your program, it is wise to print out to the screen frequently so you can see what’s going on (and perhaps what’s going wrong!). But once you start running programs that do LOTS of calculations, then do input and output sparingly; input and output require FAR more time than other calculations, and you want simulations doing millions of trials to go quickly, not slowly. Your simulation has to do with a bottle of vitamin pills. The bottle of pills starts out with N pills. (More on N in a moment.) You need to take one half of a pill each day. Each day, you pull out a pill from the bottle. Assume that any pill is the bottle is equally likely to be selected. If you pull out a whole pill, then you break that pill in half, swallow one of the halves, and put the other half back in the bottle. If you pull out a half pill, then you swallow that half pill. We are interested in tracking the ratio of half pills to all the pills left in the jar. When you start with a new jar of N whole pills, there are no half pills at all, so the ratio is 0/N. When you get down to the last half pill in the jar (and no whole pills), then the ratio is 1/1. In between, what does that ratio look like? You are going to use random simulation to find out. Start with a full jar of all whole pills. (Perhaps you should use an array for this; each entry in the array would be able to record if a pill was a half or a whole pill.) Randomly pick one of the pills left in the jar. If that pill is a whole pill, change it to a half pill. If that pill is a half pill, then remove that pill from the jar. (Somehow that array entry should “disappear,” and the array should become shorter; there are different ways to do this.) After each pill is chosen, determine the ratio of half pills to all pills. For a jar holding N whole pills, your simulation will randomly choose a pill 2*N times before the jar is empty. Assume at first that your jar holds 50 pills. Fill up the jar with 50 whole pills, and empty that jar, keeping track of the ratio each time a pill is chosen. You should finish with an empty jar after 100 simulated days. Now do the same experiment 3 more times, yielding 400 data points. Now take the average of the 4 data points on day 1, day 2, and so one for all 100 days. Now you will have 500 data points in 5 series. Finally, do exactly the same thing, but this time use 100 pills. Again, do 4 repetitions, and then average. -------------------------------------------------------------------------------------------- code written in pascal is attached...Need to convert into python
Projektin tunnus (ID): 19425594

Tietoa projektista

1 ehdotus
Etäprojekti
Aktiivinen 5 vuotta sitten

Haluatko ansaita rahaa?

Freelancerin tarjouskilpailun edut

Aseta budjettisi ja aikataulu
Saa maksu työstäsi
Kuvaile ehdotustasi
Rekisteröinti ja töihin tarjoaminen on ilmaista
1 freelancerit tarjoavat keskimäärin $34 USD tätä projektia
Käyttäjän avatar
Hey There, I represent Cyber media which is a 36-year-Old company and a Google Premium Partner based in India. We have a team of 70 developers working on different Web/Mobile Technologies. We are interested in your project. Please send me a message so that we can discuss more! Regards
$34 USD 1 päivässä
0,0 (0 arvostelua)
0,0
0,0

Tietoja asiakkaasta

Maan UNITED STATES lippu
Springfield, United States
5,0
1
Maksutapa vahvistettu
Liittynyt toukok. 3, 2019

Asiakkaan vahvistus

Kiitos! Olemme lähettäneet sinulle sähköpostitse linkin, jolla voit lunastaa ilmaisen krediittisi.
Jotain meni pieleen lähetettäessä sähköpostiasi. Yritä uudelleen.
Rekisteröitynyttä käyttäjää Ilmoitettua työtä yhteensä
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Ladataan esikatselua
Lupa myönnetty Geolocation.
Kirjautumisistuntosi on vanhentunut ja sinut on kirjattu ulos. Kirjaudu uudelleen sisään.