Re: [Tutor] regarding my strange issue output not showing up as floats

2014-06-21 Thread Mark Lawrence

On 21/06/2014 01:05, Deb Wyatt wrote:

never mind.  I figured it out.  I was using %d instead of %f in my print 
statements.  duh.

Deb in WA, USA



A good job as it would have been rather difficult from your original 
post, as Jay Lozier and Alan Gauld have pointed out.  So please check 
this out http://sscce.org/ as it's a very handy reference.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Strange issue output not showing up as floats

2014-06-21 Thread Alan Gauld

On 21/06/14 00:59, Deb Wyatt wrote:

I see you solved it but for future reference...


I'm using Python 2.7 for this assignment.

input is as follows  (not in code order):
balance = 4213
annualInterestRate = 0.2
monthlyPaymentRate = 0.04
payment = monthlyPaymentRate * balance
balance = balance - payment
total_paid = payment


Not in code order is bad. We want to see the code
- and order matters.


output looks like this:

Month: 1
Minimum monthly payment: 168
Remaining balance: 4111


You show the output but didn't show us how the output was
produced. We had no chance of guessing what you were doing
wrong.

If you want help you need to help us by showing us the code.
Don't guess at what might be wrong. If its less that, say,
100 lines post the real code and post any errors.


Would any of you have a clue what could be wrong?
Deb in WA, USA


Not if you don't show us your code!

> never mind.  I figured it out.  I was using %d instead
> of %f in my print statements.  duh.

'duh', indeed but how could we possibly have helped since
you didn't post any print statements?

In future post real code, real output and real errors.
That way we have some chance of helping you.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Strange issue output not showing up as floats

2014-06-21 Thread Jay Lozier


On 06/20/2014 07:59 PM, Deb Wyatt wrote:

Hello.  I hope everyone is having a good day.  I am working on an assignment 
that is supposed to output floats.  I'm using floats in the computations and 
according to Python's rules the output should be floats, but it's not.  When I 
test in Python shell the calculations display correctly, as floats.

I'm using Python 2.7 for this assignment.

input is as follows  (not in code order):
balance = 4213
annualInterestRate = 0.2
monthlyPaymentRate = 0.04
payment = monthlyPaymentRate * balance
balance = balance - payment
total_paid = payment

output looks like this:

Month: 1
Minimum monthly payment: 168
Remaining balance: 4111
Month: 2
Minimum monthly payment: 164
Remaining balance: 4013
Month: 3
Minimum monthly payment: 160
Remaining balance: 3916
...etc...

Would any of you have a clue what could be wrong?
Deb in WA, USA


Deb,

Can you show us your full code listing or if it is lengthy the relevant 
section showing the print statement. My guess is your print formating is 
not specified correctly and it is rounding to the nearest whole number.


Jay

--
Jay Lozier
jsloz...@gmail.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: Re: Tips

2014-06-21 Thread Mark Lawrence

On 21/06/2014 18:23, Alan Gauld wrote:

On 21/06/14 01:45, Alex Kleider wrote:


The only applicability that fits in with anything I've experienced has
to do with the necessity of globals to represent command line parameters


That's not a necessity and I hardly ever do that... :-)
But it is one pattern for handling CL args.

Other common patterns are for state machines.
That's where a system responds to events differently depending
on what events have already been seen.

Another is GUIs where the most common pattern is known as
Model-View-Controller. The implementation of MVC varies
greatly between languages, toolkits and technologies
(Web v Desktop, say) But they all use MVC as the pattern.

There are many others especially in the Smalltalk and Java
communities where the nature of the languages as well as
their community culture tend to restrict the solution
choices somewhat (although each in very different ways).

There are various pattern web sites. Wikipedia is a good
starting point:

http://en.wikipedia.org/wiki/Software_design_pattern



Try adding Alex Martelli when looking for anything about Python 
patterns.  He's one of those people who've forgotten more about Python 
than I've ever learned, the @#$%^&* :)


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] regarding my strange issue output not showing up as floats

2014-06-21 Thread Deb Wyatt
never mind.  I figured it out.  I was using %d instead of %f in my print 
statements.  duh.

Deb in WA, USA


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Strange issue output not showing up as floats

2014-06-21 Thread Deb Wyatt
Hello.  I hope everyone is having a good day.  I am working on an assignment 
that is supposed to output floats.  I'm using floats in the computations and 
according to Python's rules the output should be floats, but it's not.  When I 
test in Python shell the calculations display correctly, as floats.

I'm using Python 2.7 for this assignment.

input is as follows  (not in code order):
balance = 4213
annualInterestRate = 0.2
monthlyPaymentRate = 0.04
payment = monthlyPaymentRate * balance
balance = balance - payment
total_paid = payment

output looks like this:

Month: 1
Minimum monthly payment: 168
Remaining balance: 4111
Month: 2
Minimum monthly payment: 164
Remaining balance: 4013
Month: 3
Minimum monthly payment: 160
Remaining balance: 3916
...etc...

Would any of you have a clue what could be wrong?
Deb in WA, USA


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Check it out at http://www.inbox.com/earth


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: Re: Tips

2014-06-21 Thread Alan Gauld

On 21/06/14 01:45, Alex Kleider wrote:


The only applicability that fits in with anything I've experienced has
to do with the necessity of globals to represent command line parameters


That's not a necessity and I hardly ever do that... :-)
But it is one pattern for handling CL args.

Other common patterns are for state machines.
That's where a system responds to events differently depending
on what events have already been seen.

Another is GUIs where the most common pattern is known as
Model-View-Controller. The implementation of MVC varies
greatly between languages, toolkits and technologies
(Web v Desktop, say) But they all use MVC as the pattern.

There are many others especially in the Smalltalk and Java
communities where the nature of the languages as well as
their community culture tend to restrict the solution
choices somewhat (although each in very different ways).

There are various pattern web sites. Wikipedia is a good
starting point:

http://en.wikipedia.org/wiki/Software_design_pattern

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor