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

Closed Thread
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 December 17th, 2012, 02:31 AM
Jezza25 Jezza25 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 8 Jezza25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 39 m 36 sec
Reputation Power: 0
Python Result to Number

Hi

Can I get some assistance with the following

Code:

Letter = raw_input("Enter Letter")
A = 7
B = 8
C = 9
print Letter

I have left the basic info but if the Letter A is entered in the print Letter it results A, I want it to give the result 7

Jezza

Reply With Quote
  #2  
Old December 17th, 2012, 05:08 AM
dariyoosh's Avatar
dariyoosh dariyoosh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Location: Iran / France
Posts: 132 dariyoosh User rank is First Lieutenant (10000 - 20000 Reputation Level)dariyoosh User rank is First Lieutenant (10000 - 20000 Reputation Level)dariyoosh User rank is First Lieutenant (10000 - 20000 Reputation Level)dariyoosh User rank is First Lieutenant (10000 - 20000 Reputation Level)dariyoosh User rank is First Lieutenant (10000 - 20000 Reputation Level)dariyoosh User rank is First Lieutenant (10000 - 20000 Reputation Level)dariyoosh User rank is First Lieutenant (10000 - 20000 Reputation Level)dariyoosh User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 6 h 25 m 17 sec
Reputation Power: 133
Hi,


I'm not sure whether I understood your problem exactly, but what I understand is that you wish to map each letter into the numeric values defined for those corresponding letters in your code. For me that works like a dictionary

Code:
>>> dictionary = {'A':7, 'B':8, 'C':9}
>>> letter = raw_input('Enter letter: ')
Enter letter: A
>>>
>>> print (dictionary[letter])
7
>>> 



Regards,
Dariyoosh

Reply With Quote
  #3  
Old December 17th, 2012, 05:17 AM
Jezza25 Jezza25 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 8 Jezza25 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 39 m 36 sec
Reputation Power: 0
Thanks

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Python Result to Number

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