Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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 October 25th, 2012, 06:53 AM
tania.joseph tania.joseph is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 1 tania.joseph User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 46 sec
Reputation Power: 0
Adding

A = str(input("please enter the first number "))
B = str(input("please enter the second number "))
C = str(input("please enter the third number "))
D = str(input("please enter the fourth number "))
E = str(input("please enter the fifth number "))
F = str(input("please enter the sixth number "))
G = str(input("please enter the seventh number "))
H = str(input("please enter the eighth number "))

print ( A , B , C , D , E , F , G , H)

add = (H + F + D + B)
print (add)



I have been trying to add the last bit for a while but it doesnt seem to be working!! what do i need to do?? please help!!

Reply With Quote
  #2  
Old October 25th, 2012, 10:25 AM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,383 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 13 h 35 m 58 sec
Reputation Power: 383
It looks like you're using python 3. But actually, your program is coincidentally the same. Also, "It doesn't work." is amazing trend with questions in these forums. Please, what did you expect from your program?


I'll take this funky guess that for entries
1
2
3
4
you want python to display 10 instead of 1234.

The problem is is that you're working with strings. Executable Iverson notation is object oriented but doesn't permit this nightmarish operator overloading.

In python
"first string" + 'second string'
catenates (joins) the strings producing a new string,
'first stringsecond string'

To add numbers you need to use numbers. Where you have str(input('prompt')) use
float(input('prompt'))

if you're using python2 then
input('prompt')
is sufficient.

In python3 input() returns a string.
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Adding

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap