15,185 Topics

Member Avatar for
Member Avatar for Lynick

Hello I am completely new to Python and I dont know how to prompt the user and use the information from the console in my code. So I guess the simplest example would be If I had to prompt the user for the raidus of a circle then print the …

Member Avatar for M.S.
0
100
Member Avatar for pashah

Hello I need help ASAP, my problem is due by thursday.....Here is the problem my teacher has given... "Create a class that describes a box. The user should be able to submit the length, width, and height of a box. Also, you should include methods/functions to determine the surface area …

Member Avatar for pashah
0
174
Member Avatar for lewashby

import wx app = wx.App() win = wx.Frame(None) win.Show() app.MainLoop() Why does the above code only work in python2.7 and not 3?

Member Avatar for Lardmeister
0
133
Member Avatar for lewashby

#!/usr/bin/python3 print('Content-type: text/plain') # prints an empty line, to end the headers print('Hello, world!') I'M trying to get the above python cgi output to load in my web browser but the browser is just displaying the code it's self. My apache program is working because I just tried the phpinfo …

Member Avatar for menimeni
0
104
Member Avatar for Matigo

Hello everyone Is there any way to kill the python.exe in Task Managaer "On Windows" using visual basic The Problem is that i do open more than 1 python file at the same, But on task manager it's hows me something like this Python.exe python.exe python.exe python.exe I have got …

Member Avatar for Lardmeister
0
1K
Member Avatar for menimeni

I want to print a file using win32api. I have a network printer using this ip: 192.168.1.50 So i used this code: import win32api file_path="test.txt" win32api.ShellExecute(0, "print", file_path, None, ".", 0) How can i print this file on the printer that i don't have the name but the ip? Its …

0
54
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
703
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
382
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
274
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
168
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

The End.