Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57928

Re: Help with guessing game :D

From Alister <alister.ware@ntlworld.com>
Subject Re: Help with guessing game :D
Newsgroups comp.lang.python
References (5 earlier) <3ab8c365-0985-4035-947c-4d991d9690d7@googlegroups.com> <0qObu.26731$eW3.17586@fx14.am4> <a307611a-c9f7-4c41-856f-564ab7dbb089@googlegroups.com> <azPbu.26732$eW3.9171@fx14.am4> <99ff184c-8e49-48d5-97f8-1a7be0a57ca0@googlegroups.com>
Message-ID <neRbu.26733$eW3.19770@fx14.am4> (permalink)
Organization virginmedia.com
Date 2013-10-29 16:19 +0000

Show all headers | View raw


On Tue, 29 Oct 2013 07:40:20 -0700, Robert Gonda wrote:
>> >> 
>> >> remember that strings are a sequence.
>> >> they can be used as iterators & sliced in the same way as lists &
>> 
>> >> tuples.
>> >> 
>> >> Let a fool hold his tongue and he will pass for a sage.
>> 
>> 
>> >> 
>> >> 		-- Publilius Syrus
>> 
>> 
>> > 
>> > Now you have confused me completely, sorry im just new to python and
>> > just learning everything :) could you perhaps give me an example? or
>> > part of the code that's missing?

>> you will probably learn more through trial & error than you will from
>> being given an answer
>> 
>> to shine some more light on my advise try the following
>> 
>> code="7689"
>> for digit in code:
>> 	print(digit)
>> 
>> does this give you any Ideas on how to proceed?
> 
> Unfortunately I'm not that sort of person, the way my brain learns is by
> experimenting, but first I need to know exactly what to write. Then I
> will play around with it and customize it to my needs, sorry to be such
> a bother guys :/ and thanks again for your help it's appreciated a lot
> :)

I wont provide the code but i will try to break the problem down into 
simple steps (this is the most important skill to develop in programming)


set the number to be guessed
get the user input
step through each digit in the input
compare to the co-responding digit in the number to be guessed
generate the required output

actually let me just expand on my earlier teaser code

does this switch on any light-bulbs for you

data='7865'
guess=input('guess')
for key,digit in enumerate(data):
	print digit,guess[key]
-- 
Watch all-night Donna Reed reruns until your mind resembles oatmeal.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 04:45 -0700
  Re: Help with guessing game :D Chris Angelico <rosuav@gmail.com> - 2013-10-29 22:53 +1100
    Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 04:54 -0700
      Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 05:05 -0700
        Re: Help with guessing game :D Alister <alister.ware@ntlworld.com> - 2013-10-29 12:58 +0000
          Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 06:03 -0700
            Re: Help with guessing game :D Alister <alister.ware@ntlworld.com> - 2013-10-29 13:07 +0000
              Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 06:10 -0700
                Re: Help with guessing game :D Alister <alister.ware@ntlworld.com> - 2013-10-29 14:25 +0000
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 07:40 -0700
                Re: Help with guessing game :D Alister <alister.ware@ntlworld.com> - 2013-10-29 16:19 +0000
                Re: Help with guessing game :D Neil Cerutti <neilc@norwich.edu> - 2013-10-29 17:22 +0000
                Re: Help with guessing game :D rusi <rustompmody@gmail.com> - 2013-10-29 10:32 -0700
                Re: Help with guessing game :D rusi <rustompmody@gmail.com> - 2013-10-29 09:24 -0700
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 09:31 -0700
                Re: Help with guessing game :D rusi <rustompmody@gmail.com> - 2013-10-29 09:40 -0700
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 10:05 -0700
                Re: Help with guessing game :D rusi <rustompmody@gmail.com> - 2013-10-29 10:13 -0700
                Re: Help with guessing game :D rurpy@yahoo.com - 2013-10-29 10:24 -0700
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 10:45 -0700
                Re: Help with guessing game :D rurpy@yahoo.com - 2013-10-29 11:27 -0700
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 11:35 -0700
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 12:03 -0700
                Re: Help with guessing game :D rurpy@yahoo.com - 2013-10-29 12:55 -0700
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 13:08 -0700
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 13:21 -0700
                Re: Help with guessing game :D rurpy@yahoo.com - 2013-10-29 14:25 -0700
                Re: Help with guessing game :D rusi <rustompmody@gmail.com> - 2013-10-29 10:52 -0700
                Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 10:55 -0700
                Re: Help with guessing game :D rurpy@yahoo.com - 2013-10-29 11:26 -0700
                Re: Help with guessing game :D rusi <rustompmody@gmail.com> - 2013-10-29 11:32 -0700
  Re: Help with guessing game :D Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-29 13:44 +0000
    Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 06:52 -0700
  Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 11:05 -0700
    Re: Help with guessing game :D Dave Angel <davea@davea.name> - 2013-10-29 19:09 +0000
      Re: Help with guessing game :D Robert Gonda <robertgonda1994@gmail.com> - 2013-10-29 12:15 -0700
        Re: Help with guessing game :D Dave Angel <davea@davea.name> - 2013-10-30 01:30 +0000

csiph-web