Help with guessing game :D

Alister alister.ware at ntlworld.com
Tue Oct 29 10:25:10 EDT 2013


On Tue, 29 Oct 2013 06:10:30 -0700, Robert Gonda wrote:

> On Tuesday, 29 October 2013 13:07:08 UTC, Alister  wrote:
>> On Tue, 29 Oct 2013 06:03:55 -0700, Robert Gonda wrote:
>> 
>> 
>> 
>> > On Tuesday, 29 October 2013 12:58:09 UTC, Alister  wrote:
>> 
>> >> On Tue, 29 Oct 2013 05:05:19 -0700, Robert Gonda wrote:
>> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> >> 
>> 
>> >> 
>> 
>> >> >> > 
>> >> >> > converting input()'s result to an integer, both of which
>> >> >> > suggest
>> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> >> 
>> 
>> >> 
>> 
>> >> >> 
>> 
>> >> 
>> 
>> >> 
>> >> if you need to be checking individual digits you are probably best
>> 
>> 
>> >> 
>> >> keeping the input & number to be checked as strings.
>> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> 
>> >> it would then be a trivial task to expand this program to work with
>> 
>> >> words
>> 
>> 
>> >> 
>> >> as well as numbers.
>> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> 
>> 
>> >> 
>> >> --
>> 
>> 
>> >> 
>> >> "No one gets too old to learn a new way of being stupid."
>> 
>> 
>> > 
>> > I see, so how should i do it? I wouldn't mind having no text in it I
>> 
>> > just need the program to generate the number and the user to try to
>> 
>> > guess what the number is, so for example if a python would generate
>> > num
>> 
>> > 770 and the user would guess 870 it would say NYN
>> 
>> 
>> 
>> 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?



-- 
If you're right 90% of the time, why quibble about the remaining 3%?



More information about the Python-list mailing list