0

My script is sapposed to have you choose a number and then spit out that number of 1's and 2's randomly chosen and then count and post how much.could someone help me by telling me what is wrong, i would really apreciate it, here is the script(it is a cmd script of python)

total=0
sone=0
stwo=0
res=1
user=1
maxi=0
import random
import os
import sys

while maxi<1:
  maxi=raw_input("please choose a maximum number")
else:  
  while res<2:
    print maxi
    os.system("pause")
    while total<maxi:
      num = random.randint(1,2)
      print num
      total=total+1
      if num==2:
        stwo=stwo+1
      if num==1:
        sone=sone+1
      if total==maxi:
        print "This program is about to start counting the 1's and 2's"
    print "this program will now count the total of 1's and 2's"
    print ""
    print ""
    print "*****************************************************************************"
    print "the total 1's that show up are:",sone,
    print 
    print "---"
    print "the total 2's that show up are:",stwo,
    print 
    print "---"
    print "the total number of 1's and 2's used is :"
    print total
    os.system("pause")
    user=1
    while user<2:
      opt=raw_input("type quite to quit, type restart to restart:")   
      if opt=="quit":
        print "the system will now closedown"
        os.system("pause")
        sys.exit()
      if opt==("restart"):
        user=user+3
        total=0
        stwo=0
        sone=0
        print"system will restart"
        os.system("pause")
      else:
        user=1
  print "the system will now closedown"
os.system("pause")
sys.exit()
2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by pyTony
0

I do not understand the else statement of the first while (and lot of other things of your script) as there is not any break statements inside the loop, which would not enter in it.

I have no idea what is your logic.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.