15,190 Topics
![]() | |
Hello there everyone basicly im a new student who has just started studying computing i was wondering if i could make a program to block access to some webpages for example [url]www.bbc.co.uk[/url] so if the user types in [url]www.bbc.co.uk[/url] in the adress bar i want my program to display access … | |
I just want to know if this is done right. And some suggestions on the commented line. [CODE]msg = ... import re msg = re.sub("[^\w ]", " ", msg) names = [] for x in msg.split(): if (x[0].isupper()) and not (x[1].isupper()):# I think this should be done in a different … | |
Hi. I'm new in python and I need some help. I need to make a program that does this: You put in a sentence, then the program puts it in a list. Words can be with one or more spaces; if there are more than one, the program should recognize … | |
Wget is a very useful tool, however, I dont know how to use it in python. Below is my try but with no luck. Would you tell me the right way ? Thank you very much !! I made a wwget.py [CODE] #!/usr/bin/python import urllib2, urllib img=wget("http://blog.freetimegears.com.tw/patrick/archives/Maple-tree.jpg") [/CODE] Running in … | |
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 … | |
[CODE]red_ratio=int(factor/red_average(pic)) for pixel in pic: red=media.get_red(pixel) if red*red_ratio>=255: new_red=255 elif red*red_ratio<255: new_red=red*red_ratio media.set_red(pixel,new_red)[/CODE] ''Adjust the pixels of that Picture so that the average red value of the Picture is the same as the integer value provided.''' i cant figure out why scale_red gives me 0 instead of 100 | |
ONE '''you are given two file names: fin: the input file, and fout:the output file. The argument maxlen is an integer > 2, indicating the maximum length of each line in the output file. the function will read the fin as a text file line by line, and depending on … | |
from Tkinter import * import sys Root=Tk() RTitle=Root.title("Windows") RWidth=Root.winfo_screenwidth() RHeight=Root.winfo_screenheight() Root.geometry("%dx%d")%(RWidth,RHeight)) mainloop() Hello. When I run this code the window takes up the entire screen(win7).but remains below the bottom of the window portion of the taskbar. Even if the screen size is changed automatically carry out this.According to the height … | |
Hi, I need some assistance trying to delete elements in list. Your task is to write a function, called bawdlerize(<sent>, <word>), which removes an unsavory word, <word>, from a sentence, <sent>. Use the "del" operator on lists for this function. Example: s = ["now", "is", "the", "time", "for", "all", "good", … | |
Here some experiments to pretty print polynomials with help of vegaseat's tip of wx.lib.fancytext. | |
im creating a 2d side scroller in my class, and i have a image list out of a sprite sheet. and when the player goes forward the images show up fine, but i cant seem to get each image to flip when the player turns around and goes back, any … | |
Ok I have narrowed the problem down, and I'm hoping somebody knows the solution. Basically I have a pyGTK application, using widgets and all of that. I have stripped all of the gtk objects out except the gtk.main() initializer. I basically want to start a threading process, and still have … | |
Am I able to read or write to a file with this code or what is stumping me. The following is what I am suppose to do. Calculate each employee’s pay, and write it out to a sequential file. Be sure to include file I/O error handling logic. Include only … | |
Hi I am fairly new to python. I want to do a seating reservation program containing 32 seats so the users can reserve seats and unreserve seats. I know I need a class that sort of contains the seats, but I dont know how to make it.... I have made … | |
i have this code to simulated a walk going either forwards or backwards amd i need to modify it so that it can go either up, down, left or right. only problem is im stuck can you offer any advice? thanks [code] import random filename="walk1.txt" def randWalk(n): steps = 0 … | |
Hello, all professionals, I used subprocess.Popen to launch a process, right now I am planning to shut it down after a given time. Can I use subprocess.kill() to fulfill that? (I do not know how to do that cuz every time I will receive a error message.) [CODE] import subprocess … | |
I tried to generate permutations by using itertools module but its not working. [CODE=python] >>>print(permutations([1,2,3],3)) <itertools.permutations object at 0xa917c5c> [/CODE] Why is it so? and how do I make it work properly? | |
hi so i need to write a rock paper scissors game. when played in the command prompt it should look something like this user input is in [B]bold[/B] press q at any time to quit please choose rock(r), paper(p) or scissors(s): [B]r[/B] computer chose paper. you lose! your score: 0 … | |
Hi I'm new to python, I need a little help, i need to write a function that's has a radius parameter and retunes the circumference of the circle. anyone that's able to help ? sorry its not a lot of info to go on. ![]() | |
hello, can someone help me to do the graphic part of my program from latin letters to arabic numbers and visesersa? You write in the number/letters and then you push the arabic button or the latin botton and then it transelate.... Also i need a latin calculator which can + … | |
Hi All Hope you all are ok. I have a query on calculating frequency distribution. I have seven different files like the one I have attached which contains items as below in example. I want to know total how many times each pair occurs combining all these files. ex 208015_at … | |
Following the Python3 Tutorial for non-programmers I took on the exercise of creating "quit" and "lock/log out" options for a very simple program, as follows (comments in the code are pretty dumb and obvious, but they are notes for mydumbself): [CODE]#!/usr/bin/python3 # Filename: lockunlock.py password = str() logged = 2 … | |
How do I sort a list in Python alphabetically? The code that is used for Python 2 doesn't seem to work: [CODE=python] mylist.sort() [/CODE] Since the file I'm working with has all text in the same case, case doesn't matter here. Please help. Thanks. | |
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') … | |
Hi all. I'm having a bit of trouble implementing the basics of a multi panel GUI. Basically I need a GUI that will act as an in-dash display for a car. The home screen will offer the user the ability to chose a selection of buttons. For example, the 'settings' … | |
The following def is my assignment .. the problem is the accumulator pattern gets me very lost. I don't know how to write it.. I have asked my instructor for help and he refers me to the sad sad book we have been given. I DO NOT WANT THIS QUESTION … | |
Hello everyone, I was wondering, if I wanted to make my code a little smaller in one file, is it possible for me to import another file I made? E.G. (Very simple e.g. just for helping understand what I mean) Let's say I made a program that the user types … | |
I am trying to Subclass ElementTree with an abstract method. I have read in several forums that ElementTree is actually both a module and a class. I have been unable to get the subclassing to work. [CODE]from abc import ABCMeta, abstractmethod from xml.etree.ElementTree import ElementTree, Element, tostring class A(ElementTree): __metaclass__ … | |
Since I am a Python beginner, I was thinking about studying,and possibly working on some real-world software written in Python. So could you guys suggest some simple open source projects that I could use to study and, if possible, get involved with in development. Thanks. | |
I am trying to implement virtual LEDs on a Python window. I turn the LED "on" by drawing a green oval. I then use root.after() to schedule another call that turns the LED "off" by drawing a dark green oval. I use a 250ms delay. There are 4 active LEDs … |
The End.