Start New Discussion Reply to this Discussion how to compare 2 str in python
how can i compare 2 string for bull hit game in python.
i wrote the program itself.
how can i find how many hits and bulls i have.
import string
import random
import re
m = input (' Please input the long of the string you want to guess :')
m= int(m)
a = string.ascii_lowercase
b = ''.join(random.choice(a) for x in range(m))
print(b)
print ('now you can start guessing')
z = input ('input your guess :')
while b != z:
if len(b) != len(z):
print(' please enter a guess with the same lenght')
print(' *reminder: its a',m,'letters long')
z = input ('input another guess :')
else:
for i in str(z)
print('you got $S pulls and $S hits')
print(' Guess Again')
z = input ('input another guess :')
else:
print('nice guess')
Related Article: PIL or equivalent for saving images in Python 3.x
is a solved Python discussion thread by pyguy62 that has 7 replies, was last updated 1 year ago and has been tagged with the keywords: fruitcake, images, python, python3.x, tkinter.
Shady Baddarni
Newbie Poster
1 post since Nov 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page rendered in 0.0592 seconds
using 2.65MB