python - Why won't this code execute? -
python - Why won't this code execute? -
this programme takes 3 digits, stores them, , repeatedly guesses , checks until 3 stored digits match 3 guessed digits. cannot seem past first while loop execute:
digitone = int(raw_input()) digittwo = int(raw_input()) digitthree = int(raw_input()) digitthree = int(raw_input()) countdigitone = 0 countdigittwo = 0 countdigitthree = 0 while digitone <= countdigitone: if digitone < countdigitone: print "digit 1 be", countdigitone countdigitone += 1 elif digitone == countdigitone: print "digit 1 is", countdigitone while digittwo <= countdigittwo: if digittwo < countdigittwo: print "the first 2 digits be", countdigitone, countdigittwo countdigittwo += 1 elif digittwo == countdigittwo: print "digits 1 , 2 are", countdigitone, countdigittwo while digitthree <= countdigitthree: if digitthree < countdigitthree: print "the 3-digit number be", countdigitone, countdigittwo, countdigitthree countdigitthree += 1 elif digitthree == countdigitthree: print "this definetly number!", countdigitone, countdigittwo, countdigitthree break
and there is. currently, takes numbers, prints word none, , stops. there way prepare this?
while digitone <= countdigitone
means unless digitone negative number never less countdigitone
set 0
i following, loop until find value of each digit , print values @ end:
digit_one = int(raw_input()) digit_two = int(raw_input()) digit_three= int(raw_input()) count_digit_one = 0 count_digit_two = 0 count_digit_three= 0 while digit_one > count_digit_one: print "digit 1 be", count_digit_one count_digit_one += 1 while digit_two > count_digit_two: print "the first 2 digits be", count_digit_one, count_digit_two count_digit_two += 1 while digit_three> count_digit_three: print "the first 3 digits be", count_digit_one, count_digit_two count_digit_three += 1 print "this number! {}{}{}".format(count_digit_one, count_digit_two, count_digit_three)
python
Comments
Post a Comment