Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Timeit module
Post: RE: Timeit module

Got it! Thanks. Yeah they're just 2 different sets
Miraclefruit Data Science 9 5,844 Jan-28-2018, 04:16 AM
    Thread: Timeit module
Post: RE: Timeit module

How does that take the intersection into consideration?
Miraclefruit Data Science 9 5,844 Jan-28-2018, 03:43 AM
    Thread: Timeit module
Post: RE: Timeit module

(Jan-28-2018, 02:25 AM)egslava Wrote: %%timeit import numpy as np NUM_ELEMS = 10 SCALE = 1000 s1 = set( (np.random.rand(NUM_ELEMS) * SCALE).astype('int') ) s2 = set( (np.random.rand(NUM_ELEMS) * SC...
Miraclefruit Data Science 9 5,844 Jan-28-2018, 02:29 AM
    Thread: Timeit module
Post: RE: Timeit module

(Jan-28-2018, 02:16 AM)egslava Wrote: s = set(1000) This code is not runnable. how do i fix this? i really can't find any good examples of timeit module using intersection
Miraclefruit Data Science 9 5,844 Jan-28-2018, 02:23 AM
    Thread: Timeit module
Post: Timeit module

I'm trying to see the runtime of s.intersection(t) that takes two sets s and t and returns a new set with all the elements that occur in both s and t. So, for example, i want to try running |s| = 10...
Miraclefruit Data Science 9 5,844 Jan-28-2018, 02:00 AM
    Thread: Helping understand classes
Post: RE: Helping understand classes

(Nov-27-2017, 01:43 AM)Larz60+ Wrote: To really understand how this code works, load it up with a debugger and single step through the entire process, looking at all the variables along the way. I'...
Miraclefruit General Coding Help 10 6,270 Nov-27-2017, 02:15 AM
    Thread: Helping understand classes
Post: RE: Helping understand classes

This is one of the quiz solutions from the MIT courseware. So I'm really confused as to how they got that. (Nov-26-2017, 10:58 AM)heiner55 Wrote: This is the outout: Output:Rectangle with area 6.0...
Miraclefruit General Coding Help 10 6,270 Nov-27-2017, 01:31 AM
  Question Thread: Helping understand classes
Post: Helping understand classes

According to the solutions, the following code prints out  Square with side 5.0 Rectangle with area 6.0 Circle with radius 2.0 Square with side 6.0 Rectangle with area 6.0 Circle with radius 1.0 clas...
Miraclefruit General Coding Help 10 6,270 Nov-26-2017, 03:54 AM
  Question Thread: Implementing classes , RSS feed program
Post: Implementing classes , RSS feed program

News Feed Program. I need help fixing these errors listed below. My code is completed but I don't know how to approach these errors. If you'd like detailed description of the assignment: https://ocw.m...
Miraclefruit Homework 1 3,508 Oct-16-2017, 02:16 PM
    Thread: Sorting File
Post: Sorting File

Write a program that displays the current justices ordered by the year they joined the Supreme Court.  So there is a file containing the justices in this form:  Henry,Baldwin,Andrew Jackson,PA,1830,...
Miraclefruit Homework 1 3,396 Apr-15-2017, 10:40 PM
    Thread: Starting to use functions help
Post: RE: Starting to use functions help

[quote pid='12946' dateline='1490173276'] This seems to be working: [/quote] def getInput():     h = int(input("Enter the initial height of the ball: "))     v = int(input("Enter the initial velocity ...
Miraclefruit General Coding Help 5 7,535 Mar-22-2017, 03:52 PM
  Question Thread: Starting to use functions help
Post: Starting to use functions help

Write a program to provide information on the height of a ball thrown straight up into the air. The program should request as input the initial height, h feet, and the initial velocity, v feet per sec...
Miraclefruit General Coding Help 5 7,535 Mar-22-2017, 02:39 AM
    Thread: While loop/half-life
Post: RE: While loop/half-life

(Mar-06-2017, 02:27 AM)ichabod801 Wrote: Okay, but what's the condition on the while loop going to be? while (carbon > 0.5)?
Miraclefruit Homework 6 8,421 Mar-06-2017, 02:38 AM
    Thread: While loop/half-life
Post: RE: While loop/half-life

i wasthnking divide by 0.012%? or keep multplying by 0.0988% in the while loop
Miraclefruit Homework 6 8,421 Mar-06-2017, 02:24 AM
    Thread: Newtons problem
Post: RE: Newtons problem

(Mar-06-2017, 02:16 AM)micseydel Wrote: You're off by a 0 in your k constant. wow i can't believe that was the problem haha. thanks
Miraclefruit Homework 2 5,533 Mar-06-2017, 02:23 AM
    Thread: Newtons problem
Post: Newtons problem

Newton’s Law of Cooling states that when a hot liquid is placed in a cool room, each minute the decrease in the temperature is approximately proportional to the difference between the liquid’s tempera...
Miraclefruit Homework 2 5,533 Mar-06-2017, 01:56 AM
    Thread: While loop/half-life
Post: While loop/half-life

Carbon-14 is constantly produced in Earth’s upper atmosphere due to interactions between cosmic rays and nitrogen, and is found in all plants and animals. After a plant or animal dies, its amount of c...
Miraclefruit Homework 6 8,421 Mar-06-2017, 01:50 AM
    Thread: While loops
Post: RE: While loops

Thank you, that's a way better to put it.
Miraclefruit General Coding Help 7 5,331 Mar-06-2017, 01:49 AM
    Thread: While loops
Post: While loops

L = [2, 4, 6, 8] total = 0 while L != []:      total += L[0]      L = L[1:] print(total)How do I make this snippet simplified/clearer?
Miraclefruit General Coding Help 7 5,331 Mar-06-2017, 12:05 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020