15,179 Topics

Member Avatar for
Member Avatar for nUmbdA

Hello again, I am working on another homework problem for my fundamentals class and my brain just isn't working. Like always I am looking for direction not for someone to do the work for me. So I have to create a program that asks for 5 test scores and will …

Member Avatar for Lardmeister
0
330
Member Avatar for woah123

I'm given a text document with marks and course codes, and I need to create a function where you input the directory of the file, and the course code. Doing so, the code will return the average mark of all the marks in the text with that course code. Any …

Member Avatar for woah123
0
204
Member Avatar for nickick

I am using the following code on my raspberry pi (with debian as the os), and when i run it, it says: cannot load image C:/root/desktop/Snake.bmp * Traceback (most recent call last): File "/root/game.py", line 25, in <module> background, tmp_rect = load_image('Snake.bmp') File "/root/game.py", line 11, in load_image raise SystemExit, …

Member Avatar for woooee
0
213
Member Avatar for hotblink

Hi there, I just wanted to ask how I would go about writing a single function to count the frequency of numbers 0-10 including .5(such as 1.5,2.5) This is what I have done file = open ('grade.txt', 'r') s=file.readline() grade=[] while s[0:3]!="EOF": s=s.replace(' ','') lst=s.split(',') if lst[0][0]!='I': grade.append(float(lst[5])) print(lst) s=file.readline() …

Member Avatar for hughesadam_87
0
387
Member Avatar for fantasma.delespacio.773

I've been looking for a way to work with polynomials using python, did someone already wrote a code to do that?. Here's what i have until now using dictionaries as polynomials -for example: x^4-6x^2+1 would be {4:1, 2:-6, 0:1}-, someone have any suggestion to make? def degree(f): t = sorted(f.keys()) …

Member Avatar for hughesadam_87
0
165
Member Avatar for bladelord76

Hello. I am attempting to make a text-based game in Python. Although I assumed it would be rather easy, there are not that many examples to go by. Therefore, I've come to ask for some assistance with my code - being the relative newbie to coding that I am. Excuse …

Member Avatar for Blacktono4
0
1K
Member Avatar for HiHe

Method onPaint does not change the color. Does anyone know why? (there are no errors received) # explore the wxChoice widget # a simple ComboBox (dropdown box) that combines a ListBox with an EditBox # can't get the self.onPaint method to work!!!!! import wx ID_CHOICE = 120 ID_PANEL = 130 …

Member Avatar for HiHe
0
702
Member Avatar for Triarius_1

hi master programmers ! I am new to programming and i have an assignment im working on, it seems simple but i just cant get it ! i was wondering if anyone could help ! it would be greatly appreciated ! here is the question : =================================== "The sample input …

Member Avatar for vesuvius
0
380
Member Avatar for nUmbdA

Hello again, I am working on a homework problem and I am not able to get the accumulator to accumulate the tickets sales for each section. My assignment is to create a basic program that will use loops. I need to have it ask for each day of the week …

Member Avatar for nUmbdA
0
207
Member Avatar for Sarah2012

def get_score(word): '''(str) -> int Return the point value the word earns. Word length: < 3: 0 points 6-9: 1 point per character in word 7-11: 2 points per character in word 10+: 3 points per character in word >>> word_score('DRUDGERY') 16 ''' I have this homework I want some …

Member Avatar for HiHe
0
120
Member Avatar for hotblink

Hi, I seem to be having some trouble converting the output of this(which is a list) to a string of integers. What I want ultimately is for the output to just be integers. After that I also need to determine how many times an integer appears. I know I need …

Member Avatar for snippsat
0
429
Member Avatar for DarkMonarch

Hey, been awhile. I'm working on a portal for distributors, some type of JIT (just in time) implementation. Now i've been reading alot on DB so i can implement the right database and the right data structure. Now i see, i can do alot more then i'm use to do. …

Member Avatar for madCoder
0
151
Member Avatar for krystosan

i need help i thought i was doing it right but later when i looked at data it turned out to be something else I have 4 lines of code that i want to convert to single line list comprehension `newLst=[] for each in os.listdir(locationTxt): if os.path.isdir(os.path.join(locationTxt,each)): if each not …

Member Avatar for TrustyTony
0
175
Member Avatar for shayallenhill

I think I can learn a lot from any answer to the two questions in this post. OK, I’ve got a large object. That object has attributes and does things. Those attributes also do things. MOST of what they do is sit there like a list, int, or np.array and …

Member Avatar for shayallenhill
0
127
Member Avatar for john200000005

I have specified the path variable as C:\Python27\Lib\site-packages;C:\Python27\Tools\Scripts. To recall this on MS DOS I used python myScript.py'so the program till reponds error syntax please could you help me.

Member Avatar for rrashkin
0
64
Member Avatar for TeaAnyOne

I made this code which outputs . ... ..... ...*****. ....***... .....*..... but its supposed to output . ... ..... .*****. ...***... .....*..... Any ideas what im doing wrong? To output the triangle myChar1 = * myChar2 = . myLen = 3 myChar1 = input("Select first character: ") myChar2 = …

Member Avatar for TeaAnyOne
0
124
Member Avatar for hotblink

Hi, I need some help to make a program where python reads each line(a string) of a .txt file. -sample txt file-(EOF stands for 'End of File) I need it to be able to read up to 300 students. ID , Last , First, Lecture, Tutorial, A1, A2, A3, A4, …

Member Avatar for snippsat
0
424
Member Avatar for raghuvbhat

Hi.. i am new to python and I want to put logfile to get the logs for every function including that function name with arguments. could any one help on this. Thanks raghuvbhat

Member Avatar for woooee
0
60
Member Avatar for rocket3443

Hi, I am having a problem when I'm trying to open and read a file with python. My code goes as follows: def main(): f = open('nummer.txt', 'r') text = f.readlines() print(text) main() But when I try to run the code, I get an error. (No such file or directory). …

Member Avatar for woooee
0
445
Member Avatar for raghuvbhat

Hello.. I have function as below to create logfile and write logs to it. It works fine in python shell. But once you convert it into sql server query, its not working. Any idea why so? import logging import time from datetime import datetime labellog = "C:\LabelLog" + datetime.now().strftime("%Y%m%d_%H%M%S")+".log" logging.basicConfig(filename=labellog,format='%(asctime)s …

Member Avatar for TrustyTony
0
135
Member Avatar for TrustyTony

Now that MITx first test is over, I got feeling that this one task requested for generate and test solution is begging also for less efficient recursive solution as it is so simple. Here it is! Single liner aproved by the released grader! If you wander if you are able …

0
313
Member Avatar for apayn

Hey guys Andrew here, with another problem. My while loop is made so that it is on, or off, simple eh? That's what I thought, but it doesn't seem to be acting as I would expect it to! The problem is, when I want it to loop, in testing it …

Member Avatar for M.S.
0
269
Member Avatar for TeaAnyOne

This is some code I have made to count the most occuring vowels within the inputted message. Everytime I run it, it prints out it out 5 times, how can I fix this? I also want it to display a message when there is no vowel entered. Maybe someone can …

Member Avatar for vegaseat
0
167
Member Avatar for dylan.lange.16

Hey so i've decided to try out writing some stuff in python after a while. My approach to this probably isn't the most efficient, but i'm sure you guys will see what i'm trying to do. I'm having troubles with the last part of the program with my askForRestart function. …

Member Avatar for woooee
0
115
Member Avatar for bradrick42

I am working on some pre-processing. i have a group of text files whose names are dates (i.e. 20120201). data in each file is organized like this: 20120201_line number field1: 123124235 field2:ergjenrgjnergoiefoiefoenr . . field10:dfgkjndgknrkj 20120201_line number . . . The line number is the only thing that separates the …

Member Avatar for woooee
0
166
Member Avatar for F1Fan12

Hi All, I am writing a program in which I take data for a table from the user, and then ask for the alignment for each column. Then I have to display it. Each column mush be separated by a tab and a space. For example, let's say the user …

Member Avatar for woooee
0
5K
Member Avatar for nag18

Hi i am trying to create a game that uses 2 scripts one that creats the game instance and another that hold the varbles of monsters and the player as well as the game my problem is i am trying to creat "rooms" for each area with in the game …

Member Avatar for TrustyTony
0
94
Member Avatar for ThePythonNoob

I have two inherited classes in another class Class A(object): def printhello(self): self.message1="hello" Class B(object): def printbye(self): self.message2="bye" Class C(A,B): def __init__(self): super(C,self).printhello() def printboth(self): print(self.message1) print(self.message2) a = A() b = B() c = C() c.printboth() How do I super both A and B?, note this is just an …

Member Avatar for TrustyTony
0
2K
Member Avatar for Melly3

import random as r def main(): roll1 = r.randint(1,6) roll2 = r.randint(1,6) point= 4,5,6,8,9,10 sum= roll1 + roll2 print("phase 1") print ("You rolled:", roll1, "and", roll2) if sum == 2 or sum== 3 or sum == 12: print("Game Over. You lose" ) elif sum == 7 or sum == 11: …

Member Avatar for snippsat
0
3K
Member Avatar for alexandra.hoops.3

I have to write a program that asks the user how many pumpkin weights they have, and the reads that many pumpkin weights, printing each weight with two decimeal points and a comment and displays data about them to four decimal places. I need to find the average weight, maximum …

Member Avatar for ThePythonNoob
0
579

The End.