Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 21st, 2003, 11:54 PM
Infinite_Knight Infinite_Knight is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 10 Infinite_Knight User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Multiplying in python?

I have to make this prog work, but I keep getting errors.Please some one look at this and tell me whats wrong with the code?

print "-----------"
print "Priceticket"
print "-----------"
print
ques = ("What was the cost of the ticket?")

T = ques * 0.07

I = ques

G = ques % (0.07)

print " -----------------------------------------"
print "| Pricebusters! |"
print "|-----------------------------------------|"
print "| Item Cost | GST | Total Price |"
print "|-------------+---------+---------------|"
print "| ,I | ,G | ,T |"
print " ----------------------------------------"

Reply With Quote
  #2  
Old September 22nd, 2003, 01:43 AM
Infinite_Knight Infinite_Knight is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 10 Infinite_Knight User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
NM I found out that it was my printing it shouls be like this:

print "|",I ,"|$",G ,"|$",T ,"|"

to make it print right blaa too tired :P

Reply With Quote
  #3  
Old September 22nd, 2003, 09:31 AM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Uh, that and you aren't taking any input ... so ... it's not just that you were printing things wrong, but I see no raw_input() in there. Also, the easier way of doing the output is to use string formatting:

Code:
print "| %.2f | $%.2f | $%.2f |" % (I, G, T)


For example:
Code:
>>> I = 2.0; G = 3.0; T = 4.0
>>> print "| %.2f | $%.2f | $%.2f |" % (I, G, T)
| 2.00 | $3.00 | $4.00 |


And also, you might consider better variable names.

Reply With Quote
  #4  
Old September 22nd, 2003, 07:18 PM
Infinite_Knight Infinite_Knight is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 10 Infinite_Knight User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thxs i was tried last night and didnt see that :P

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Multiplying in python?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT