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()

it also appears that my while loop(first one) doesnt work.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.