324 Posted Topics

Member Avatar for ddanbe
Member Avatar for vegaseat
Member Avatar for Lardmeister
5
3K
Member Avatar for kiddo39
Member Avatar for ibrahim.sawaneh.16
Member Avatar for kiddo39

Like Dr. Griboullis says, this will work: sentence = "I now have a total of %s yellow bananas!" for i in range(2, 11): print sentence % i

Member Avatar for kiddo39
0
274
Member Avatar for vegaseat
Member Avatar for dani_boy

A shorter version of the PyGame approach: import pygame as pg try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk def play(): pg.mixer.music.play() # pick .wav .ogg .mid or .mp3 music files you have in # the working folder, otherwise give the full file …

Member Avatar for HiHe
0
3K
Member Avatar for acrocephalus
Member Avatar for yuimikazuki

Your assumption is correct. Line 29 unpacks the 3 item tuple that is returned to the 3 variables beans, jars, crates You can use a test print to show the return `print secret_formula(start_point)`

Member Avatar for HiHe
0
163
Member Avatar for ItsAdZy

Eric5 is a great IDE, I use it all the time. Under the Extra tab I like spell checking and the large set of tools.

Member Avatar for RogueHaxor
0
1K
Member Avatar for vegaseat

This seems to work: # using the Python Image Library (PIL) to resize an image # works with Python27 and Python32 from PIL import Image import os image_file = "Flowers.jpg" img_org = Image.open(image_file) # get the size of the original image width_org, height_org = img_org.size # set the resizing factor …

Member Avatar for Budy_1
0
73K
Member Avatar for debasisdas
Member Avatar for Caulm64

One approach would be to create a list of the numeric inputs and then use Python functions min and max to get the result. Here would be a typical example: # create a list of integer/whole number inputs mylist = [] while True: n = int(input("Enter a whole number (-99 …

Member Avatar for sneekula
0
10K
Member Avatar for HiHe
Member Avatar for idiotguy
Member Avatar for Tcll
0
716
Member Avatar for <M/>

When I am hiking in the mountains I carry my mouthharmonica along.

Member Avatar for diafol
0
236
Member Avatar for Xantipius
Member Avatar for Dearden

I reckon the idea was that healthy mothers and their healthy children are good for the future of this country! However, that is not on the agenda of the Koch brothers who supported many of the radical members of congress. They want less taxes!

Member Avatar for Ancient Dragon
0
844
Member Avatar for HiHe

I just read an article in the paper that tech savvy younger folks prefer public transportation, so they can use their time with a notebook computer or tablet, rather than wasting time in a car going to work. How do you get to work?

Member Avatar for pixelsoul
2
181
Member Avatar for glao

The argument count=0 is the default value in case count is not used, like when you call the function initially. But in your calls inside the recursive function you give count the updated value.

Member Avatar for glao
0
193
Member Avatar for stevewilliams02

Take a look at: http://www.daniweb.com/software-development/python/code/216550/tkinter-to-put-a-gif-image-on-a-canvas-python You have to do the button part.

Member Avatar for stevewilliams02
0
1K
Member Avatar for dark_falzar

The nice thing about Python is it's friendly syntax when compared to Java or PHP. Also Python is a powerful modular language with many modern programming concepts.

Member Avatar for ryantroop
0
337
Member Avatar for flebber

You are trying to use a list as a dictionary key. Python list objects are mutable and can not be used as keys. You could change them to tuples.

Member Avatar for flebber
0
223
Member Avatar for pythonnewbie16

You don't have to import the math module. Follow Scol_R_LEA's advice, it will make your code more orderly and easier to read. It will be easier to get help.

Member Avatar for HiHe
0
940
Member Avatar for stevewilliams02

See also: http://www.daniweb.com/software-development/python/code/216852/an-image-button-python-and-tk

Member Avatar for HiHe
0
328
Member Avatar for Ancient Dragon
Member Avatar for GrimJack
0
395
Member Avatar for glao

If you put your exit condition in the while line, then whatever is in the while block of statements will execute during that final loop.

Member Avatar for glao
0
269
Member Avatar for Jacklittle01
Member Avatar for antonio.neal.39

Looks like lines 6 and 13 are just test prints for your information. Most programmers just comment them out.

Member Avatar for HiHe
0
222
Member Avatar for a8med

I agree, passing your variables via self to your class methods will make your life easier.

Member Avatar for vegaseat
0
232
Member Avatar for booicu

One hint: print(random.sample(range(1000), 100)) This will show you a list of 100 unique random integers with values from 0 to 999.

Member Avatar for vegaseat
0
3K
Member Avatar for pythonnewbie16

At your level of experience you need to write your code a few lines at a time and run it. Look at the error messages if they come up and correct the code.

Member Avatar for pythonnewbie16
0
253
Member Avatar for ksekwamote
Member Avatar for Phenol
Member Avatar for Shivam1234
Member Avatar for vegaseat
Member Avatar for HiHe
Member Avatar for elliotell333
Member Avatar for tinstaafl
0
244
Member Avatar for acmarshall
Member Avatar for HiHe
0
10K
Member Avatar for Hyperion101

Just comment out clrscr(), it is sort of silly to use. Mostly a leftover from the rather outdated Turbo C.

Member Avatar for HiHe
0
383
Member Avatar for aVar++

We have already spent 2.7 trillion on the wars on Iraq and Afghanistan, why not spent another trillion in Syria to install a radical Moslem government there too.

Member Avatar for HiHe
3
2K
Member Avatar for HiHe

Can anyone give this a try? '''print_error_python33.py there are times when a print() trailing newline disappears with Python 3.3.0 this does not happen with Python 3.2.3 or Python 2.7.3 ''' size = 180000 print("creating long string of %d sevens" % size) # create a long string of digits s2 = …

Member Avatar for vegaseat
0
338
Member Avatar for jingda
Member Avatar for vegaseat

Or use something like this: mixed_numeric_list =['1e3', '+3.14', '-77', '0x123abc', '0b1111'] numeric_list = [eval(n) for n in mixed_numeric_list] print(numeric_list) ''' [1000.0, 3.14, -77, 1194684, 15] '''

Member Avatar for BearofNH
1
2K
Member Avatar for pythonforlife

Don't use file as a variable name since file() is function in python2 You don't do anything with f

Member Avatar for pythonforlife
0
202
Member Avatar for dp121307

I assume you have the module calgraphics. The code example is written poorly and does not assign a namespace. Just hope that Monitor is a class from the module, see if you can find it in the module source code.

Member Avatar for dp121307
0
535
Member Avatar for aadarsh_khare
Member Avatar for JasonHippy
-1
277
Member Avatar for BigPaw
Member Avatar for Koljik
Member Avatar for laver68xo

At this point it would be nice to know what your input data is. And what you expect your output data to look like.

Member Avatar for HiHe
0
204

The End.