15,181 Topics
| |
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 … | |
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' + ' … | |
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 … | |
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 … | |
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 … | |
| |
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, … | |
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, … | |
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 … | |
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 … | |
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. … | |
| 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 … |
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 | |
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 … | |
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 | |
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 ? | |
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 ! | |
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 … | |
Python module turtle makes it simple to draw graphics art similar to art done by the Logo language. | |
Using Python module turtle to draw a Koch snow fractal. | |
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 … | |
Anyone creating an OS with Python (Tkinter)? | |
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 … | |
Please can anybody help me to make a calculator for finding area of different shape. And my python version is 3.2. | |
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 … | |
Hello everyone! I have made a game intended for the Rasberry pi in python. It is called Pi Blocks, but all of my friends with windows want to play it, so I've been trying and trying to get the game into an exectutable format, but nothing seems to work! I've … | |
I am using Beautiful Soup 4, python 3.x on a project just to learn it. 1. soup = BeautifulSoup(s ) # use default parser 2. soup = BeautifulSoup(s, 'html5lib') # specified parser Actually #2 solved my problem already. But, when using the first approach I got different behavior on my … | |
I've been set an assignment to find all the prime numbers smaller than N We've been told to first create a function to test if it is divisble by any numbers in my primes list and then second to create a function to test each integer from 2 to N, … | |
The most efficient static sieve generator in python I have seen so far. Returns the list of primes, that are not greater than n. |
The End.