bumsfeld 413 Nearly a Posting Virtuoso

More examples:

# a multiconditional statement
if x > 0:
  if x < 10:
    print("x is larger than zero and less than 10")

# a simpler version
if 0 < x < 10:
  print("x is larger than zero and less than 10")

# is character lower case?
if 'a' <= character <= 'z':
  print(character)
bumsfeld 413 Nearly a Posting Virtuoso

Use list slicing and extend().
Hint:

mylist = [0,1,2,3,4,5,6,7,8,9]
ix = 3

t1 = mylist[0:ix]
t2 = mylist[ix+1:]

# now use list extend()
t2.extend(t1)

print(t2)  # [4, 5, 6, 7, 8, 9, 0, 1, 2]
bumsfeld 413 Nearly a Posting Virtuoso

Python has all the tools to do such a thing.

bumsfeld 413 Nearly a Posting Virtuoso

Use slice and extend(), for example:

mylist1 = [1,2,3]
mylist2 = ['a','b','c']

# slice mylist into two temporary lists at index 2
t1 = mylist1[0:2]
t2 = mylist1[2:]

# now use list extend()
t1.extend(mylist2)
t1.extend(t2)

print(t1)  # [1, 2, 'a', 'b', 'c', 3]
bumsfeld 413 Nearly a Posting Virtuoso

Split your large project into a series of small projects.

bumsfeld 413 Nearly a Posting Virtuoso

Get yourself a Raspberry Pi and start a project.

Check out:
http://www.raspberrypi.org/
http://www.instructables.com/id/Raspberry-Pi-Projects/

bumsfeld 413 Nearly a Posting Virtuoso

gesundheit

bumsfeld 413 Nearly a Posting Virtuoso

One computer is just not enough. I usually have my desktop PC, two netbooks and an IPad going.

bumsfeld 413 Nearly a Posting Virtuoso

"He was a wise man who invented beer."
~~~ Plato

bumsfeld 413 Nearly a Posting Virtuoso

It's Oktoberfest time, the time for a good bratwurst, grilled chicken, radish, potato salad, all washed down with a stein full of beer.

bumsfeld 413 Nearly a Posting Virtuoso

"A fool with a tool is still a fool."
~~ Roland Hirsch

bumsfeld 413 Nearly a Posting Virtuoso

The IPython Notebook seems to be made for scientific presentations and reports.
To show off things like numpy, matplotlib.pyplot, pylab, seaborn and guiqwt.pyplot. You can tweak your code and see the result in real time.

bumsfeld 413 Nearly a Posting Virtuoso

The strontium clock developed in the US would only have lost only about one second since the earth began. It is accurate to a second in five billion years.

bumsfeld 413 Nearly a Posting Virtuoso

Caesium was discovered in 1860 by German scientists Robert Bunsen and Gustav Kirchhoff. It's a silvery metal with a golden cast that melts at 28.4C (just above room temperature).

It is used in the Caesium Clock at the National Physical Laboratory in the London suburb of Teddington. The clock is accurate to one second in 1.4 million years.

Source:
http://www.bbc.com/news/magazine-29476893

bumsfeld 413 Nearly a Posting Virtuoso

I agree with JorgeM, real world examples/projects are important to keep the students interested.

bumsfeld 413 Nearly a Posting Virtuoso

An IDE like PyScripter would redline line 11 because of the missing comma.

You can also streamline your code further with another function to remove some of the repetition:

def main():
    shipweight = float(input('Please enter the weight of the item you wish to ship: '))
    shipping_charges(shipweight)

def shipping_charges_calc(rate, shipweight):
    print("{} pounds will cost you ${:0.2f} per pound.".format(shipweight, rate))
    total= rate * shipweight
    print("Therefore, your total shipping charge would be ${:0.2f}".format(total))

def shipping_charges(shipweight):
    if shipweight <= 2:
        rate=1.10
    elif shipweight <= 6:
        rate=2.20
    elif shipweight <= 10:
        rate=3.70
    # shipweight > 10 pounds
    else:
        rate=3.80
    shipping_charges_calc(rate, shipweight)

main()

Also read up on the function format(), commonly used with Python 2.7 and higher.

Nice coding though.

bumsfeld 413 Nearly a Posting Virtuoso

Variable daniel will have to an instance of class Radiobutton.

check with
print(type(daniel))

bumsfeld 413 Nearly a Posting Virtuoso

“Why not go out on a limb? That's where the fruit is.”
~~ Will Rogers

bumsfeld 413 Nearly a Posting Virtuoso

Closeup shots of people's faces reading off information in a manner they would not normally talk to each other. Those investigative shows are loaded with it.

bumsfeld 413 Nearly a Posting Virtuoso

Windows 8.1 works for me most of the time!
Not sure if Windows 10.1 will be much better.

bumsfeld 413 Nearly a Posting Virtuoso

Fruit bats, a delicacy for some West Africans, are considered to be the Ebola virus's natural host.

Source:
http://www.bbc.com/news/world-us-canada-29462431

bumsfeld 413 Nearly a Posting Virtuoso

I think I get the idea.

bumsfeld 413 Nearly a Posting Virtuoso

Does anybody have a good example of a Functor in Python?

bumsfeld 413 Nearly a Posting Virtuoso
bumsfeld 413 Nearly a Posting Virtuoso

A little Python history:

Python 1.0 - January 1994
Python 1.5 - December 31, 1997
Python 1.6 - September 5, 2000

Python 2.0 - October 16, 2000
Python 2.1 - April 17, 2001
Python 2.2 - December 21, 2001
Python 2.3 - July 29, 2003
Python 2.4 - November 30, 2004
Python 2.5 - September 19, 2006
Python 2.6 - October 1, 2008
Python 2.7 - July 3, 2010

Python 3.0 - December 3, 2008
Python 3.1 - June 27, 2009
Python 3.2 - February 20, 2011
Python 3.3 - September 29, 2012
Python 3.4 - March 16, 2014

bumsfeld 413 Nearly a Posting Virtuoso

Windows 95 was released on August 24, 1995
As far as computing is concerned this is really, really old!
I can't believe that there are many machines left out there.
Maybe in some museum basement.

bumsfeld 413 Nearly a Posting Virtuoso

Honda parts are expensive and in high demand.

bumsfeld 413 Nearly a Posting Virtuoso

If you are not very handsome, things get tough. How about a sports car to impress her with?

bumsfeld 413 Nearly a Posting Virtuoso

Children should be told to be in a sport rather than watch it.
It takes a couch potato to raise a couch spud.

bumsfeld 413 Nearly a Posting Virtuoso

Eggs and mushroom with one piece of honey cake and hot chocolate

bumsfeld 413 Nearly a Posting Virtuoso

Steve Ballmer is stepping down because he is running MS into the ground with a lot of me-too ware and a management style of forced ranking. He most likely was not aware of the spy portion of Windows8.

bumsfeld 413 Nearly a Posting Virtuoso

Something does not work right with code stuff!
Ah, delayed action!

bumsfeld 413 Nearly a Posting Virtuoso

pythondevguy do this:

import random
x = random.randint(1, 100)
print(x)
x = random.randint(1, 100)
print(x)
bumsfeld 413 Nearly a Posting Virtuoso

Here is a hint:

sum3 = 0
for n in range(0, 1000, 3):
    #print(n)  # test
    sum3 += n

print(sum3)
bumsfeld 413 Nearly a Posting Virtuoso

What value does vbNullString represent?

bumsfeld 413 Nearly a Posting Virtuoso

I guess you can find good engineers in any country, also the bad ones.

bumsfeld 413 Nearly a Posting Virtuoso

I would use the length of string.
Works well in most languages.

bumsfeld 413 Nearly a Posting Virtuoso

I have some neighbors who just spent over $5,000 for their dog's surgery. The dog has one massive tumor that comes back.

bumsfeld 413 Nearly a Posting Virtuoso

Let's not forget that WxPython is just the wrapper for WxWindows which is written in C++.
The wrapper seems to ignore the C++ error handling. It could have been done, but wasn't.
I don't think there is any GUI toolkit that is written in pure Python, bummer.

On the other hand Python is very good glue language for other languages. It's easy to make wrappers.

bumsfeld 413 Nearly a Posting Virtuoso

It might be important to hide numbers, this code does not:

# -*- coding: cp1252 -*-
''' encrypt105.py
modified code from james.lu.75491856 (James Lu)
'''

# needs to be at beginning of program code
# allows Python27 to use PYthon3 print() options
from __future__ import print_function
import string

def crypt(text, code):
    ''' encodes or decodes '''
    e_text = ""
    for c in text:
        e_text += code.get(c, c)
    return e_text    

# establish letter code dictionary
code = dict(zip(string.letters, string.letters[::-1]))

text = '''\
will pay $3,250,000 for the 98 diamonds
'''

encrypted = crypt(text, code)
print("encrypted:\n{}".format(encrypted))

print('-'*50)

decrypted = crypt(encrypted, code)
print("decrypted:\n{}".format(decrypted))

''' my result ...
encrypted:
ÍÜÙÙ ÔäË $3,250,000 ßÕÒ ÐÝà 98 áÜäØÕÖáÑ

--------------------------------------------------
decrypted:
will pay $3,250,000 for the 98 diamonds
'''
bumsfeld 413 Nearly a Posting Virtuoso

Quick looky shows an indentation problem.

james.lu.75491856 commented: no code shown +0
bumsfeld 413 Nearly a Posting Virtuoso

Give us some code!

bumsfeld 413 Nearly a Posting Virtuoso

What was the mistake?

bumsfeld 413 Nearly a Posting Virtuoso

Yes

bumsfeld 413 Nearly a Posting Virtuoso

Java gets updated about once a week.

bumsfeld 413 Nearly a Posting Virtuoso

@James.Lu
How would you mix up a dictionary with a random seed?

bumsfeld 413 Nearly a Posting Virtuoso

One fist full of Jelly Bellies.

bumsfeld 413 Nearly a Posting Virtuoso

The water can easily be recycled. I read that North of Las Vegas a large molten salt solar plant is being built. The molten salt is usually a mixture of sodium and potassium nitrate maybe with some nitrites thrown in. The whole thing melts relatively low and then is stored at about 1000 degF in big well insulated steel tanks. From there it is pumped to heat exchangers to produce steam for the turbines as needed. Nevada Energy is buying the power generated, NE is owned by Warren Buffet, one of the richest man on earth.

bumsfeld 413 Nearly a Posting Virtuoso

Your example answer is wrong.

bumsfeld 413 Nearly a Posting Virtuoso

You could potentially us a label as a spacer:

try:
    # Python2
    import Tkinter as tk
except ImportError:
    # Python3
    import tkinter as tk

root = tk.Tk()
root['bg'] = 'yellow'

# use label as spacer, match background color
spacer = tk.Label(root, width=20, bg='yellow')
spacer.grid(row=1, column=1)

button = tk.Button(root, text="Button1")
# puts button to the right of label spacer
button.grid(row=1, column=2)

root.mainloop()