Question about lesson #19 Learn python the hard way

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 2673 Views - Last Post: 25 February 2015 - 01:11 PM Rate Topic: -----

#16 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Question about lesson #19 Learn python the hard way

Posted 21 February 2015 - 04:22 PM

Here is a screencast on how to use code tags. They are essential for Python code.

This post has been edited by andrewsw: 21 February 2015 - 04:23 PM

Was This Post Helpful? 0
  • +
  • -

#17 albert003   User is offline

  • D.I.C Addict

Reputation: 39
  • View blog
  • Posts: 993
  • Joined: 15-December 14

Re: Question about lesson #19 Learn python the hard way

Posted 25 February 2015 - 11:03 AM

View Postjon.kiparsky, on 18 February 2015 - 01:03 PM, said:

View Postalbert003, on 18 February 2015 - 01:34 PM, said:

Am I close?


Not very. Remember how dictionary lookups work? If you have

d = {'a':1, 'b':3, 'c':43}


then what would you do to look up a value in d?

I think I put my reply on my name and not your name.
Please tell me if I'm closer this time?. I really want to get better at python and I like to try and figure out puzzles problems on python. This is what I think you wanted me to do.
#params = {'foo':10,'bar':20,'baz':30'}
#I can leave it as an integer
foo=10
#I can also convert an integer into a string and reverse the process.
bar=13
baz="This is a number..."
bar=str(bar)
print baz+bar
#This is my favourite hockey players number...13
#We can also reverse the process...
baz ='30'
bar=20
print int(baz)+bar
#The answer will show 50.


This post has been edited by xclite: 25 February 2015 - 01:10 PM
Reason for edit:: Fixing code tags

Was This Post Helpful? 0
  • +
  • -

#18 xclite   User is offline

  • I wrote you an code
  • member icon


Reputation: 1528
  • View blog
  • Posts: 4,448
  • Joined: 12-May 09

Re: Question about lesson #19 Learn python the hard way

Posted 25 February 2015 - 01:11 PM

Just an FYI on code tags - the code must go between the code tags.

You can also insert a bunch of code, highlight it with your cursor, and click the "[CODE]" button in the reply control panel.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2