15,185 Topics

Member Avatar for
Member Avatar for John_47

Hey, i'm having trouble with this question i was given. I'm tasked with improving a programme to calculate a differential. Here is the code i am given, which i must improve. def f(y,t): return -y + 1.0 def odestep(f,y,t,dt ): return y+dt*f(y,t) t =0; y=0; dt =0.2 tf =2.0; nsteps …

0
68
Member Avatar for John_47

Hello, i'm currently trying to write some code to find the integral of exp(-x*x). I have been given code for one trapezium rule (trap0) which is imperfect, and a second set of code for a new trapezium rule (trap1), which uses the old code and some new conditions to 'perfect' …

Member Avatar for John_47
0
215
Member Avatar for vegaseat

Starting with Python 3.3 you now have access to a high resolution time counter (nanoseconds and better).

Member Avatar for vegaseat
6
4K
Member Avatar for loemnk

hello there. in order to gain experience I started a small python project. it is an more or less simple, collaborative address book (Snow Leo and Python 2.6.1). the final step is to create a standalone programm. to create the address book I used PyQt4 and MySQLdb. since py2app chokes …

Member Avatar for vegaseat
0
5K
Member Avatar for jantrancero

So i made a script and it works fine but it could be better. The code will be written below, the purpose of the script is to make a beep sound when the timer runs out (that works) but i also want to show on the screen how many hours …

Member Avatar for CaptainFApin
0
2K
Member Avatar for HiHe
Member Avatar for Tayler_1

f = open("program0.4.txt", "w") done = input('Enter done for last name when finished') Last_Name = input("Enter Last Name: ") while Last_Name != 'done': First_Name = input("Enter First Name: ") Hrs_Wrkd =int(input("Enter Hours Worked: ")) Hrly_Wge = int(input("Enter Hourly Wage: ")) f.write('Last Name' + ' ' + 'First Name' + ' …

Member Avatar for Tayler_1
0
1K
Member Avatar for ChicagoBears2012_1

I have a function that has takes in a string "secret" sec = set(secret) print sec output: set(['A', 'C', 'E', 'I', 'H', 'M', 'S', 'T']) Assuming I called the function sending in the string "Mathematics", how do I get an ordered set. I'm looking to get unique characters in the …

Member Avatar for snippsat
0
262
Member Avatar for glez_b

The following script try to calculate the resulting average of the direction and magnitude of the wind well as daily averages of Temperature, Moisture and Sum of Precipitation. My monthly dataframe has the following column: data Fecha Hora DirViento MagViento Temperatura Humedad PreciAcu 0 2011/07/01 00:00 318 6.6 21.22 100 …

0
129
Member Avatar for boni_go

Hi, I try to copy tree by shutil.copytree(). While the function run, I get some Exception "File name too long". The path+fike name are realy long, and the exception as I understand is from the OS not Python. Do you have any solution? * I can not change the directory …

Member Avatar for edenrol
0
1K
Member Avatar for ashdane.beckford
Member Avatar for Schol-R-LEA
0
111
Member Avatar for hmx7

class student_name: def __init__(self,student): self.student = student def student_name(self): print('Student Name: ', self.student) class Majors: def __init__(self,name1,name2): self.name1 = name1 self.name2 = name2 def major(self): pass def major2(self): print('Majors: ',self.name1, self.name2) class School: def __init__(self,school): self.school = school def school_name(self): print('School Name: ', self.school) class Student_Track: def __init__(self, School, student_name, …

Member Avatar for hmx7
0
169
Member Avatar for glez_b

I have a long list of data structured in the following way Date , Time, Temperature, Moisture, Accumulated precipitation 1/01/2011, 00:00, 23, 50, 2, 1/01/2011, 00:15, 22, 45, 1, 1/01/2011, 00:30, 20, 39, 0, 1/01/2011, 01:00, 25, 34, 0, 1/01/2011, 01:15, 23, 50, 0, . . . . 1/01/2011, 23:45, …

Member Avatar for glez_b
0
3K
Member Avatar for pygeek

Hi, im new to this forum, im trying to make a text editor in python for my school, and its nearly finished, but whenever i save a text file then open it again it makes weird square symbols at the end of each line. Thanks in advance. And i didn't …

Member Avatar for pygeek
0
480
Member Avatar for james.lu.75491856

Traceback (most recent call last): File "C:\Users\James\Desktop\pvz.py", line 64, in <module> Pea((10,20)) File "C:\Users\James\Desktop\pvz.py", line 48, in __init__ Projectiles.add(self) File "C:\Python27\lib\site-packages\pygame\sprite.py", line 319, in add sprite.add_internal(self) File "C:\Python27\lib\site-packages\pygame\sprite.py", line 147, in add_internal self.__g[group] = 0 AttributeError: 'Pea' object has no attribute '_Sprite__g' import pygame,traceback width = 480 height = 640 …

Member Avatar for james.lu.75491856
0
565
Member Avatar for sreetha

sir please give me a code for finding bigrams in a given file. example .. if the word is I AM AN OLD MAN.. output should be in a list as [I AM] [AM OLD] [OLD MAN]. i have seen some programs but its giving bi grams of a word. …

Member Avatar for Gribouillis
0
112
Member Avatar for talat.zaitoun

def my_startswith(s1, s2): if s1[0] == s2[0]: return True elif s1[0] != s2[0]: return False elif s2 == '': return True elif s1 == '' and s2 == '': return True Iam having trouble with the third and fourth elif. Third elif: i need to say that if s1 is …

Member Avatar for Gribouillis
0
224
Member Avatar for Caoimhe

I am recently new to python and as part of my college work i need to design and implement a python program relating to computer system administration. I would be grateful if anyone has ideas of a project. Thank You

Member Avatar for Caoimhe
0
196
Member Avatar for glez_b

I have a monthly database and the daily data are every 15 minutes. Develop a script to calculate the average and sum of some variables. The data have the following structure: MagViento, DirViento, u, v, Humedad, Precipitacion 5.67, 245 , 7.7898, 6.5660, 100, 4.1 When I run the script, I …

0
67
Member Avatar for onalenna_1

create a program that gets the marks the user has for their classes this year. Tell them how many classes they are failing (despite what many o f you think a fail is 50%) Save as Name_Surname_Repetition_Problem1.py................i seriuosly need help with this program,python is giving me a hard tym

Member Avatar for sneekula
0
142
Member Avatar for krystosan

how do I make a class return as `Namespace(filter='b', list="['hi','by']")` class NameSpace(object): """Mock for argparse's NameSpace """ def __init__(self, lst=None, flter=None): super(NameSpace, self).__init__() self._filter = flter self._lst = lst Is it possible what I am thinking, i guess we have to do something using special method call ?

Member Avatar for krystosan
0
320
Member Avatar for Gribouillis

You can teach your linux system that executable python files must be executed with /usr/bin/python. This allows you to write python scripts without the shebang line [icode]#!/usr/bin/env python[/icode]. This snippet shows you how to do it !

Member Avatar for Gribouillis
0
1K
Member Avatar for 123pythonme

I am doing an assignment for university, so I can't exactly post the code. So I will have to explain the best I can. I have to draw 3 stars in a row, 5 points, 6 points, 7 points. We have to do it using a for loop and the …

Member Avatar for vegaseat
0
270
Member Avatar for vegaseat

Python module turtle makes it simple to draw graphics art similar to art done by the Logo language.

1
400
Member Avatar for vegaseat
Member Avatar for krystosan

In the scripts ddirectory of my dummy project I have created this file without extension and has given executable permission using chmod +x filterList #!/bin/env python print "Hello World!" 'python ~/Development/python/listFilter/python/filterList.py $1 $2' but still when I run this i get error message saying $ filterList -bash: filterList: command not …

Member Avatar for krystosan
0
798
Member Avatar for Spider_14
Member Avatar for 123pythonme

I have created a program to find all the prime numbers less than N. When N is around 10^4, the program runs fast and efficiently. If I increse it to 10^5 no output is given, even if i let it run for an hour or so. Is there anyway I …

Member Avatar for vegaseat
0
262
Member Avatar for Hashim Javed
Member Avatar for vegaseat
0
290
Member Avatar for sophia_sin

I'm having a hard time creating a program that will draw all of the stars from 3 to 7. The program needs to have: * The variables numberOfSides, numberOfTrips, firstNumberOfSides, and lastNumberOfSides. * A series of stars one after the other for 3 to 7 sides * The screen must …

Member Avatar for woooee
0
172

The End.