4,305 Posted Topics
![]() | Re: Taco Bell is part of Yum! Brands, Inc. I have some of their stock and it has done well. Yes, I do go to Taco Bell to spend some of the dividents, always liked their stuff. |
Re: I think Dai_1 was hijacking an old thread. Needs to start own thread. | |
Re: Something like this might give you a hint: http://www.daniweb.com/software-development/python/code/467824/a-simple-image-slide-show-pyside | |
Re: [QUOTE=paulthom12345;768727]Well i know this may be obvious, but Tkinter is all ready to be used in python 3. So anybody who uses that GUI toolkit will still be able to use it in python 30.[/QUOTE]Tkinter ships with the Python30, it better work! Also Tkinter uses its own language called TCL, … | |
Re: Your brain needs "sugar" to function, that limits the number of people that can avoid it. Spicy food can kill cancer is an "old wives' tale" at best. Has been around for many years without any proof. | |
Re: Here is a hint ... ''' toplevel101.py ''' from functools import partial from Tkinter import * def show_pic(img): # create child window top = Toplevel() Label(top, image=img).pack() # create the root window app = Tk() #Apply GUI title app.title("Horoscope") #Size of window. app.geometry("500x3000") # pick images you have in the … | |
Just a simple image file slide show using PySide (PyQT). | |
Re: A test ... print(True or True) # True print(True or False) # True print(False or True) # True print(False or False) # False print('-'*12) # exclusive or ^ print(True ^ True) # False print(True ^ False) # True print(False ^ True) # True print(False ^ False) # False print('-'*12) print(True … | |
Re: The line `guess = int(input("Your Guess? "))` in essence appears 3 times, see if you can use it just once. | |
Re: No computer language is easy to learn unless you put some effort and thought into it. Looks like Visual Basic might be a fine language system for you. | |
Re: When I grew up you got either breast milk or cow milk. Epensive baby formula was not available. | |
Re: I would never take a computer/tablet on our bus system here. I would be robbed in a hurry! | |
Re: A few test prints should help ... ''' nltk_tokenize102.py use module nltk to find the frequency distribution of nouns in a given text downloaded and installed: nltk-2.0.4.win32.exe from: https://pypi.python.org/pypi/nltk tested with Python27 ''' import nltk import pprint text = "This ball is blue, small and extraordinary. Like no other ball." … | |
Re: Unless it's for the exercise, I prefer a while loop over a recursive function and avoid a possible stack overflow. | |
Re: Try this ... ''' nltk_sentences101.py downloaded and installed: nltk-2.0.4.win32.exe from: https://pypi.python.org/pypi/nltk tested with Python27 ''' import nltk import pprint text="""First patented in 1876 by Alexander Graham Bell and further developed by many others, the telephone was the first device in history that enabled people to talk directly with each other … | |
Re: The most common library used to be the Python Image Library (PIL), which is now Pillow as mentioned by Jukka O For info see ... http://pillow.readthedocs.org/en/latest/ | |
Re: Get to know the project, see what others have done and show that you can do better. | |
| |
Re: Rewrite your code a little ... count = 0 phrase = "hello, world" for iteration in range(5): index = 0 while index < len(phrase): count += 1 print "index: " + str(index) index += 1 print "Iteration " + str(iteration) + "; count is: " + str(count) | |
Re: Hint ... # this test string will have 65 characters s = 'q' * 65 length = len(s) if length <= 64: encrypted = encrypt(s) else: print("string exceeds 64 characters") | |
Re: Also see ... http://www.daniweb.com/software-development/python/code/465991/high-resolution-time-measurement-python | |
Re: One of the many ways to do this ... import random def is_even(number): # Determines if the number is odd or even. if (number % 2) == 0: status = True else: status = False # Returns status as True or False return status even = 0 odd = 0 … | |
Re: Here is another example ... ''' sqlite3_employ101.py experimenting with a Python sqlite3 database of employees ''' import sqlite3 # for temporary testing you can use memory only conn = sqlite3.connect(":memory:") cur = conn.cursor() # query language in upper case is optional eye candy cur.execute('''CREATE TABLE employees( number INTEGER PRIMARY KEY … | |
Re: After your loop insert this line: `self.setLayout(self.gridLayout)` | |
| |
Re: Change your code to this ... from urllib.request import urlopen u = urlopen('http://www.ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22') info = u.read() print(type(info)) # just a test --> <class 'bytes'> f = open('rt22.xml', 'wb') f.write(info) f.close() # convert info to string before printing print(info.decode()) # test Notice that info is not a string object. | |
Re: Hint ... rate = 0.2 monthly_rate = rate/12 min_payment = 10 total = 0 for month in range(12): total += min_payment + min_payment*monthly_rate print("Month {:2d} total = {:.2f}".format(month+1, total)) # test ''' result ... Month 1 total = 10.17 Month 2 total = 20.33 Month 3 total = 30.50 Month … | |
Re: This might help too ... # words you want to ignore later text = '''\ a the on up down ''' fname = "ignorelist.txt" # write the file out with open(fname, "w") as fout: fout.write(text) # read the file back in and convert into a list with open(fname, "r") as … | |
Re: You could use a dictionary like ... d = { 'kw1' : [def1, def2, def3, ix], 'kw2' : [def1, def2, def3, ix], 'kw2' : [def1, def2, def3, ix], ... } Where keys kw1, kw2, ... are the keywords and values are a list of definitions for each keyword, and the … | |
Re: See ... http://www.diveintopython.net/xml_processing/parsing_xml.html | |
Re: Nice homework, what have you done so far? | |
Re: Using a class would be much better than using global variables. | |
Re: This will work ... `pause = lambda: time.sleep(3)` Then call with ... `pause()` Also convert a very long text line into multiline text this way ... print """\ You will be given multiple choices throughout this adventure. How you choose determines how you end. Please answer questions in all lowercase … | |
Re: Another hint ... is_even = lambda x: x % 2 == 0 is_odd = lambda x: x & 1 == 1 # test print(is_even(3)) # False print(is_even(8)) # True print(is_odd(12)) # False print(is_odd(7)) # True | |
This example calculates timed x, y points of a projectile motion that can be used for plotting or other calculations. | |
Re: If the csv file contains the time data, then you might be better off to split date and time in the csv file. | |
Re: Hint ... # using module bisect to determine grades import bisect # both sequences have to be sorted or be in order # A is 85 or higher, B is 75 to 84 etc. grades = "FEDCBA" breakpoints = [30, 44, 66, 75, 85] def grade(total): return grades[bisect.bisect(breakpoints, total)] print … | |
Re: Good grief that code is hard to read! | |
Re: Hint ... grains_sum = 0 grains = 1 for square in range(1, 64+1): print(square, grains) # test grains *= 2 grains_sum += grains print(grains_sum) # test | |
| |
Re: Ah, just in time for halloween. A web crawler visits a given URL and retrieves any URLs from the hyperlinks on that page. It visits these URLs and collects more URLs and so on. Kind of spooky. What you do with these URLs is up to you. You can collect … | |
Re: You could put the more repetitive tasks into a function. Something like this ... import random def get_guess(direction=""): return int(raw_input("Please guess a {} number: ".format(direction))) number = random.randrange(100)+1 print("Guess a number from 1 to 100 game ...\n") tries = 1 attempts = int(raw_input("Please enter the number of attempts you want: … | |
Re: You can sort by two criteria this way ... import operator as op # a test dictionary with name:[age,weight] pairs mydict = { 'Zack' : [35, 210], 'Adam' : [24, 175], 'John' : [35, 150], 'Tony' : [35, 244] } # convert to list of (name, age, weight) tuples mylist … | |
A Python sort with a helper function to allow for mixed order sort like age descending and weight ascending. | |
Re: Hint ... import itertools as it # create non-repeating pairs print(list(it.combinations('ABCD', 2))) ''' result ... [('A', 'B'), ('A', 'C'), ('A', 'D'), ('B', 'C'), ('B', 'D'), ('C', 'D')] ''' Note: Instead of 'ABCD' use a sequence of (x, y) coordinate points. |
The End.