15,181 Topics
| |
I am wanting to create a program that everytime I run it, it gets the current playing tune in iTunes, and sets this as my Facebook status: "I'm listening to current_playing_song, corrent_artist." I have no idea how to start. can someone suggest how? | |
What is a static method and when should I use one? | |
I'm looking for some major help. I'm a decently new coder, taking a Python class independent study. I was writing a program for a two-player 21 game. (Like blackjack only I start with only one card... for some reason.) Only problem is, while the code doesn't seem to contain any … | |
I have two similar lists and want to create a new list with just the differences between the two. Is there an existing function or do I have to iterate with a for loop? | |
Hi, I want to make a program that can make asterisks around the text, so the output is something like this: Enter string: Hello World ************* * Hello World * ************* I do not want to use the multiplication technique (ex: "*" * 5), and I want to try using … | |
hello, i have some form which split by iframe. subject field is no probelm ,but content field was come from another iframe source.. so i can't input text in content's field.. im using PAMIE and win32com module.. i have to put text in 'contents.contentsValue' here. but i have no luck..anyone … | |
I am building a code that needs to find the average of a set of scores in a list that can have amounts added and removed. I know how to find the average of a list of scores of a fixed number can someone help me on how to find … | |
I always wondered how a programmer could efficiently generate a random number from a set* of numbers once and only once. I quickly realized the inefficient solution. Simply generate the number and if it equals one you have all ready generated then regenerate the number. Regenerating the number is a … | |
| A simple function to return the number of occurances of a letter in a text. An easier way to implement this would be by using a dictionary :) P.S sorry if there already is a code snipped like that somewhere. |
I can't find a simple command that does this. If there's no command that does this I'm going to spam python.org until they finally agree to put this in the next version of python. | |
I'm writing code in python for a tic tac toe game. I have ran into a problem. can any one help me out. thanks # TIC TAC TOE # Started: 10/19/09 # Ended: still in progress #GLOBAL CONSTANTS X = "X" O = "O" Empty = " " TIE = … | |
I've got a book for python 2. in school and the problem is that we're programming in 3. which makes it difficult from time to time to get it right, cause you cant just copy the text in the book to the shell. I'm stuck with this ex: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # … | |
This snippet shows a fast and efficient way to cut strings in substrings with a fixed length (note that the last substring may be smaller). | |
i need to write code for two "robots" that will chase each other around the screen. im stuck on a command which is the step(x,y) command which take the (x,y) coordinates of the other robot as a parameter which should just contain "pass" and will be overridden by the subclass. … | |
with the function: list(string) you put every letter from the string in a list, I want to put each 2 letters in a list so If I had the string: ThisIsATestt I want to get a list: ['Th','is','Is','AT','es','tt'] (There will never be a letter alone, so you don't have to … | |
Do you use or abuse list comprehensions? Do you recognise a duck when you see one? Do you unpack when you start assignments? I'm looking to connect with raw 'professionals' but exceptionally talented coders with good academics and who know Python inside out. The company are one of the fastest … | |
Hello, I'm trying to create a program that calculates the hypotenuse and area of a right triangle. I need to round the hypotenuse to 2 places after the decimal, and one place for the area However, I can't seem to get it to work If I tried c = int(round(math.sqrt(a**2) … | |
how do you write a command that turn left or right at an angle in a superclass is it like this: def left(self): self.position += self.angle return (self.position) its part of Object oriented Python | |
I've gotten some great responses to my questions here, so I'm really grateful for this resource of programmers on this website. I've been working on an algorithm and am almost completed with it, but I'm finding out the very last steps are the most difficult for me because they require … | |
Hello everyone, I need some help with instances and loops (I am a very new programmer). Basically, I have a problem where I need to make a program that has a circle move around a window every time the user clicks. This circle is suppose to have a text box … | |
| Hi guys, I saw quite a few posts regarding this but I was unable to solve this problem that I am facing. First off, when I do the following in my setup.py, windows=[ { 'script': 'gulhane.py', 'icon_resources': [(1, "icon.ico")] } ], Python crashes and I am unable to run the … |
I am trying to add to an empty list in python and I am having trouble. Ill give an example of the code to see if anyone can help me out.... num = 0 mylist = [] while num < 10: num = num + 1 mylist = mylist + … | |
I more than half way through the book "Python programming for the absolute beginner" 2nd Ed. and things are really starting to get hairy. The book has me to write some code just before or after explaining each part. But I have to really concentrate on the paragraph I'M reading … | |
I need to split a float in 2, but the split function doesnt work with floats... What is an alternative for this? If I have 2.4 I want to get 2 and 4 In math you've got a function fpart and ipart, but I don't know this is possible in … | |
okay I tried to make a reverse of finding the num value of a letter bu it returns in an error :f [quote]Traceback (most recent call last): File "/home/darragh/Bureaublad/t.py", line 15, in <module> numtolet('A') File "/home/darragh/Bureaublad/t.py", line 6, in numtolet letters['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] TypeError: list indices must be integers, not tuple[/quote] [code=python]def … | |
I want to use a while loop to count up numbers. The output would be something like this: Start: 1 End: 10 Count by: 3 1 4 7 10 Here's my code right now: [CODE] start = int(raw_input("Start at: ")) end = int(raw_input("End at: ")) count = int(raw_input("Count by: ")) … | |
I have a this bonus problem for class that I don't have a clue where to start. We have been using the cImage module and the question is: [B]Write a function called DrawTriangle that takes parameters img, x1, y1, x2, y2, x3, y3 and col, where col is a Pixel … | |
I more than half way through the book "Python programming for the absolute beginner" 2nd Ed. and things are really starting to get hairy. The book has me to write some code just before or after explaining each part. But I have to really concentrate on the paragraph I'M reading … | |
Is there a built-in function to give the value of a letter? what I mean is a=1 b=2 c=3 d=4 e=5 f=6 ... something like letval(a) would give me 1 | |
So the Goal is: given a Nested list that contains 3 elements in each element in the nest, i.e. L1=[[1,2,3],[4,5,6],[7,8,9],[10,11,12]] how can I take a flat list, i.e. L2=[1,2,3,4,11] where if the elements within the nested list, i.e. L1[0], L1[1], etc. intersect with any single element in L2, the element … |
The End.