- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 15
- Posts with Upvotes
- 12
- Upvoting Members
- 7
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
hey everyone im making a program that takes a number (n) from the user and then decides if it is prime or not and prints that decision to the screen [CODE] from math import * def main(): n=eval(input("please enter the number you wish to check:")) n=abs(n) if n < 2: … |
|
Title says all. I need to make a code that gives the prime factorization of a number and put them in a (this is important) a list. |
|
i've got an assignment to write a program that simulates a game of snaps in python but don't know how to get started, your help would be appreciated! Here is the question: Write a program to allow the simulation of a game of Snap. Assume two humans will play, but … |
|
Can someone please show me the best way to achieve this with the least amount of lines? Im a recovering PHP coder, I have one solution. I was wondering if there was a quicker more pythony way to do this: I have in "results" [ICODE][('Basp1', 'Aen2'), ('Basp1', 'Ahy18'), ('Basp1', 'Ahy26'), … |
|
I dont know how to start. I learn python by myself, hopefully i can solve this problem. but i think i need your guys help A palindrome is a sentence that contains the same sequence of letters reading it either forwards or backwards. For example "racecar". Write a recursive function … |
|
I am reading a text file inside Python that contains salaries and the raise they will receive as a percent. I am trying to multiply the initial salary by the percent and print the salary after the raise has been applied. I keep receiving an error message which is as … |
|
hi guys n girls im making a list of the biggest files on my computer i have got most of the coding done but i have hit a brick wall with the sort function. i can sort the size or the file name but as they are both in the … |
|
Hi can anyone tell me how to remove empty keys in the following dictionary d={'a':[],'b':['1','2'],'c':[]} I want it to be d={'b':['1','2']} I tried this. But its showing error. I know its wrong to change the size of a dictionary during iteration. But is there any other way? [CODE]>>> for x … |
|
|
|
Ive made this quick program to strip the "youtube - " prefix off my mp3 collection, so i started modifying a script i had made before to replace file names with a <filename><incrementing number> type name. It has gone well so far, with the only problem being it will strip … |
|
I just started to learn gui with wxpython I can see many objects have a style attribute, for example TextCtrl, self.inputArea = wx.TextCtrl(self.background, style=wx.TE_PROCESS_ENTER) Where can I see a list of available style for each object? Thanks |
|
Hey all, Hopefully this will help someone with a problem I encountered. For a few days now I was looking for a way to concisely set the attributes to numerous controls without duplicating attribute code again and again. For example, let's say I have 3 static text controls and I … |
|
Hi, this is my first post here at Daniweb. Seems like an active and friendly environment. I have very limited experience with programming in general, and even more so with GUI programming. As the title suggests, I want to stop a while loop by the use of buttons. When I … |
|
Hi Okay so i have a text file and i have it converted to a bunch of lists with strings as the words. Now i need to find words that occur only once in the entire text file, how can i do this using a loop? A hint says that … |
|
Guys I am trying t write this script that finds the age of a daughter through palindromes. Here is the question: Recently I had a visit with my mom and we realized that the two digits that make up my age when reversed resulted in her age. For example, if … |
|
I have printed the contents of 2 folders to separate txt files. It is in the form of a python list ['a', 'b', etc.] How could I loop through the files looking for matching list elements? My first problem is how to extract the words from out of the quotes … |
|
[COLOR="Red"]COULD ANY GEEK HELP ME FIND OUT WHAT IS WRONG WITH MY CODE FOR RE?[/COLOR] [COLOR="Green"]SINCE THE BACK PART IS MARKED INVALID SYNTAX......[/COLOR] [CODE]'''you are given a bunch of phone numbers in a file whose name is provided by parameter name_fin, each line has exectly one phone number. They look … |
|
i have a string s= The POST variable NM_xwTapCtl%24_img_Banner is vulnerable.,The POST variable NM_xwTapCtl%24scrollTop is vulnerable. I dont know the procedure to modify that s to s = NM_xwTapCtl%24_img_Banner,NM_xwTapCtl%24scrollTop HELP ME PLEASE!!!!!!!!!!!!!! ( i think search for The Post Variable and display the next word ,after that again search if … |
|
I'm trying to display a value on the status bar according to a position on a plot made on a panel. So I want to call the method SetStatusText with the value in a string. The instance of RefreshPanel is set within a frame called 'frame', which is an instance … |
|
Hi. I'm very new to python and I'm trying to write something that is conceptually very simple but I'm not sure how to approach it in python. I have 2 files, and basically want to open one file, and replace the content with something in another file. Example: file1.txt only … |
|
Hi all, Ive been working on this little piece of code down there that removes the odd numbers from a list of numbers. I get an "IndexError: list index out of range" whenever I try to run it. From what I understand, it means that l[i] is attempting to use … |
|
Here I am required to use REGEX to do the stock price program, yet I found it almost impossible for me to do, I can only deal with for loop. '''Parse Stock prices. Create a function that will decode the old-style fractional stock price. The price can be a simple … |
|
I am using a sample from my book for testing a car class. I get this error and I am not sure why. I am only giving one argument that I can tell. Here is my error code: Traceback (most recent call last): File "G:\Python_Stuff\car.py", line 79, in <module> myCar.getVIN('V81FDX') … |
|
# I'm trying to extract the url's from the below text, without the added html tags. Is there anyway I can get just parts starting with ( [url]http://)[/url] and ending with (")? # <a href="http://www.gumtree.sg/?ChangeLocation=Y" rel="nofollow">Singapore</a>, <a href="http://www.gumtree.com.au/?ChangeLocation=Y" rel="nofollow">Australia</a>, <a href="http://www.gumtree.co.nz/?ChangeLocation=Y" rel="nofollow">New Zealand</a>, <a href="http://www.gumtree.com" rel="nofollow">England</a>, <a href="http://edinburgh.gumtree.com" rel="nofollow">Scotland</a>, <a … |
|
I am attempting to create code where the user can alter the A elements in the list continuously. If another letter in the list is replaced however, it should ask for new input from the user, and go back to the code where the user can alter A elements in … |
|
So I made a few tutorial applications and understand the most basic Python concepts and I'm well on my way to become a Python addict, only one thing is standing between me and the road ahead. I'm trying to make my first "useful" Python application - a program that allows … |
|
I am trying to add two hexadecimal numbers. [CODE]def addbinary(n1,n2): s = "" carry = '0' for i in range(3,-1,-1): if (n1[i] == '1' and n2[i] == '1' and carry == '0'): s = '0' + s carry = '1' elif (n1[i] == '1' and n2[i] == '1' and carry … |
|
Hey guys and gals I am really struggling with this program. I have been working on it for about a week now and every time I think I am getting somewhere it seems like it flops and I get frustrated and start over. I would appreciate it if anyone could … |
|
Hi guys, Have been doing some wxPython programming and haven't had any major issues until I wanted to display images! Basically I take readings from an external device (simple input device) and set the image in a panel based on this reading. However it seems that the picture does not … |
|
The following is a recursive function designed to return the factorial of a number. [CODE] def factorial(number, target): if number == 1: return target else: target = target*number factorial((number-1), target) print factorial(7, 1) [/CODE] As you'll see if you run it however it doesn't return my 'target' variable (the factorial … |