4,305 Posted Topics

Member Avatar for bradley1234

To preserve your proper indentation check http://www.daniweb.com/community/syntax under code blocks.

Member Avatar for vegaseat
0
200
Member Avatar for Alexander_2

Looks like you have a series of hang images in an external folder. Prefix the image names with the full path to this folder. By the way, you can use the foreward slash '/' with Windows, this way you can avoid a raw string designation.

Member Avatar for vegaseat
0
8K
Member Avatar for marethamogale

Hint ... text = 'Houseboat' text = text.lower() text_rev = text[::-1] print(text) print(text_rev) print('-'*20) text = 'Racecar' text = text.lower() text_rev = text[::-1] print(text) print(text_rev)

Member Avatar for vegaseat
-1
134
Member Avatar for ksekwamote

See ... http://www.daniweb.com/software-development/python/threads/466346/word-jumble#post2031135

Member Avatar for vegaseat
0
955
Member Avatar for Lone Ramoupo

Hint ... ''' word_scramble_hint101.py create a scrambled/jumbled word that has a hint associated with it ''' import random # a list of (word, hint) tuples word_hint = [ ('mouse', 'eats cheese'), ('automobile', 'uses petrol'), ('boat', 'floats on water') ] # shuffle word_hint list in place and pick a random word …

Member Avatar for vegaseat
0
952
Member Avatar for ddanbe

Your snippet works well using ... SnippetCompiler.exe from: http://www.sliver.com/dotnet/SnippetCompiler/ I had to run this in IronPython, here is the code ... ''' ip_small_form101.py using IronPython from http://www.codeplex.com/ironpython ''' import clr clr.AddReference('System.Windows.Forms') import System.Windows.Forms as swf class Class1(swf.Form): def __init__(self): label = swf.Label() label.Text = "Hello world!" self.Controls.Add(label) form = Class1() …

Member Avatar for pitic
1
169
Member Avatar for dreking6
Member Avatar for dreking6
0
621
Member Avatar for nitin1

Even if you have your own business, you will be working for your clients/customers and the government's rules. No, you cannot wear what you want.

Member Avatar for BigPaw
0
225
Member Avatar for vegaseat
Member Avatar for HiHe
3
4K
Member Avatar for Waseemaburakia
Member Avatar for vegaseat

Starting with Python 3.3 you now have access to a high resolution time counter (nanoseconds and better).

Member Avatar for vegaseat
6
4K
Member Avatar for loemnk
Member Avatar for vegaseat
0
5K
Member Avatar for HiHe

Tuples, since they are immutable (can not be changed), are also useful for keys in a dictionary.

Member Avatar for vegaseat
0
684
Member Avatar for ChicagoBears2012_1

Try this ... ''' wants "MATHEICS" not "ACEIHMST" ''' s = "Mathematics".upper() s3 = "" for c in s: if c not in s3: s3 += c print(s3) # MATHEICS

Member Avatar for snippsat
0
269
Member Avatar for iLikePHP

Here you go ... ![9a309c399caf6d50affaf67dc54edc8a](/attachments/small/0/9a309c399caf6d50affaf67dc54edc8a.png "align-left")

Member Avatar for JorgeM
0
180
Member Avatar for ashdane.beckford

Also tell us which version of Python you are using (Python2 or Python3)

Member Avatar for Schol-R-LEA
0
113
Member Avatar for 123pythonme

Here is a hint on the turtle goto(x, y) ... ''' turtle_star_six.py draw a star with six points using Python module turtle ''' import turtle as tu def draw_star(x, y, side): star_angle = 360.0/6 left_angle = star_angle * 2 tu.penup() # start drawing here (default is center x=0, y=0) tu.goto(x, …

Member Avatar for vegaseat
0
272
Member Avatar for vegaseat

Python module turtle makes it simple to draw graphics art similar to art done by the Logo language.

1
406
Member Avatar for Begginnerdev
Member Avatar for vegaseat
Member Avatar for krackhead

The code below should work if Qbasic works at all like BCX: dim inner, outer FOR outer = 1 to 5 FOR inner = 1 to outer PRINT CHR$(inner + 64); ' stay on line NEXT innner PRINT ' new line feed NEXT outer

Member Avatar for limpstarfish.flavouredwater
-1
3K
Member Avatar for Spider_14

See ... http://linux.softpedia.com/get/System/Operating-Systems/Linux-Distributions/Python-OS-87758.shtml also ... http://sourceforge.net/projects/cleese/

Member Avatar for Assembly Guy
0
420
Member Avatar for somjit{}
Member Avatar for <M/>
0
196
Member Avatar for 123pythonme

You should have listened and read Python snippet at ... http://www.daniweb.com/software-development/python/threads/465305/python-prime-number-code-not-working#post2026050 Actually, a good sieve algorithm will run N=1000000 in about 0.1 to 0.2 seconds. If you use Python module numpy, you can do this in 0.012 seconds.

Member Avatar for vegaseat
0
262
Member Avatar for Hashim Javed

First ask the user what shape is wanted ... `shape = input("What shape do you want (triangle, square and rectangle): ")` Once the shape is given, follow it with a conditional statement like ... if shape == "rectangle": a = float(input("Enter length of side a: ")) b = float(input("Enter length …

Member Avatar for vegaseat
0
293
Member Avatar for sophia_sin

This might help ... http://www.eg.bucknell.edu/~hyde/Python3/TurtleDirections.html

Member Avatar for woooee
0
176
Member Avatar for <M/>
Member Avatar for <M/>
0
65
Member Avatar for sam.tubb.75

Is the problem that your friends don't have Python installed on their Windows computer? In what version of Python is your game coded in? See also: http://www.daniweb.com/software-development/python/threads/20774/starting-python/18#post1981507

Member Avatar for sam.tubb.75
0
332
Member Avatar for logicslab
Member Avatar for nitin1

On a Windows box: http://www.daniweb.com/software-development/c/code/216489/clear-the-screen-using-winapi-functions

Member Avatar for deceptikon
0
1K
Member Avatar for kanagamani

Use the regular swap, it makes your code simpler to maintain by others.

Member Avatar for vegaseat
-1
128
Member Avatar for 123pythonme

Also run this test ... N = 20 # list() needed for Python3 # since range() is now a generator object print(list(range(2, int(N**0.5)+1))) ''' result ... [2, 3, 4] ''' I don't think this is what you want.

Member Avatar for vegaseat
0
581
Member Avatar for slate

Hmmm, I put it to the test ... ''' primelist_timing7.py yet another primelist timing for speed ''' import timeit def time_function(stmt, setup): """use module timeit to time functions""" # to enable garbage collection start setup with 'gc.enable();' #setup = 'gc.enable();' + setup t = timeit.Timer(stmt, setup) # doing 10 passes …

Member Avatar for vegaseat
1
496
Member Avatar for nitin1

Development time with Python is much faster than with C++ The main supporter of Python is Google and they rather successfully use Python internally. Python, being a high level language, complements the low level C++ language very well. So it is worthwhile knowing both. Python, similar to Java, is portable …

Member Avatar for nitin1
0
417
Member Avatar for aVar++

We are probably sitting on a couple of thousand cruise missiles that have a limited shelf life. So it's “usem or losem”. That should help the rebels win. The only thing is that many of the "rebels" are extreme Islamists and AQ. If the extremists take over, it will make …

Member Avatar for HiHe
3
2K
Member Avatar for nitin1

Python3 is a more streamlined/modern version of Python. Python 2.7.x is the end of the Python2 line. Not all Python2 code will work with Python3, so Python 2.7 will be maintained for those folks who have a fair amount of Python2 code. Some of the popular Python3 improvements have been …

Member Avatar for nitin1
0
206
Member Avatar for happygeek
Member Avatar for toll_booth

Strange, never had any problems with numpy and Python33. I used the **numpy-MKL-1.6.2.win32-py3.3.exe** installer

Member Avatar for vegaseat
0
340
Member Avatar for wrathofmobius

My preference for the Pygame event loop exit ... ''' PG_AnimatedLines1a.py draw animated corner lines with Python module pygame modified from: http://wordpress.com/tag/pygame-tutorial/ ''' import pygame as pg w = h = 500 size = 250 step = 10 pos = 0 maxlines = 40 black = (0, 0, 0) # …

Member Avatar for vegaseat
0
892
Member Avatar for Waseemaburakia

You are close. Just a reminder, don't use sum, min, max as variable names since they are functions in Python. I like to prefix with 'my'. Start with a high mymin value (let's say 100) and make it x if x is lower. With mymax you start low (zero) and …

Member Avatar for Waseemaburakia
0
230
Member Avatar for antonio.neal.39

Another simple example is at ... http://www.daniweb.com/software-development/python/code/464630/a-ticker-for-long-messages-pythontkinter

Member Avatar for antonio.neal.39
0
296
Member Avatar for vegaseat

A simple way to find duplicate words in a text. In this case the text is preprocessed to eliminate punctuation marks and set all words to lower case.

Member Avatar for paddy3118
2
4K
Member Avatar for <M/>

Just got my yellow iPhone 5C to match my car and belly. You simply need a smartphone now-a-days so you can act like all the other idiots fingering the thing.

Member Avatar for vegaseat
0
424
Member Avatar for asif49
Member Avatar for matthew.s.thomas.14
Member Avatar for TrustyTony
0
131
Member Avatar for nytman
Member Avatar for frankenfrank

At times the speed you can develop a program is important, that's where Python will be best.

Member Avatar for vegaseat
0
425
Member Avatar for hmx7

You use a Python list object this way ... number_item = int(input('How many items do you have? ')) mylist = [] # start with an empty list count = 1 while number_item > 0: item = input('{}) Name of item: '.format(count)) mylist.append(item) number_item -= 1 count += 1 # test …

Member Avatar for hmx7
0
138
Member Avatar for MrNoobieCoder

You mean something like this ... import time def get_int(prompt="Enter an integer: "): """this function will loop until an integer is entered""" while True: try: # return breaks out of the endless while loop return int(input(prompt)) except ValueError: print("Try again, value entered was not an integer.") x = get_int ("Enter …

Member Avatar for MrNoobieCoder
0
236
Member Avatar for matthew.s.thomas.14

Simply add the numbers in each list together with function sum() and divide by the number of items in the list.

Member Avatar for BearofNH
0
384

The End.