8 Replies - 4319 Views - Last Post: 24 January 2012 - 11:11 PM Rate Topic: -----

#1 mariomix10  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-January 12

How do I restart my program when its finished converting?

Posted 22 January 2012 - 11:51 PM

q = 'quit'
ft = 'feet'
inc = 'inches'
yrds = 'yards'
x = input("What is the measurement type? Use inc, yrds or, ft. if you wish to quit, type q.")
if(x== 'quit'):
    print("Thankyou for useing this software")
    quit

if(x=='feet'):
    ft=input("What distance in feet?")
    x = input("Convert feet into what? Use yrds, or inc")
    if(x=='inches'):
        print 'your conversion of feet to inches is:', ft/12, \
        quit
    if(x=='yards'):
        print'your conversion of feet to yards is:', t*0.33333333, \
        quit

if(x=='inches'):
    inc = input("What distance in inches?")
    x = input("Convert into what? Use ft, or yrds")
    if(x=='yards'):
        print 'your conversion of inches to yards is:', inc/36,

    if(x=='feet'):
        print 'Your conversion of inches to feet is:', inc/12, \
        execfile

if(x=='yards'):
    yrds = input('What distance in yards?')
    x = input("What is your conversion type? Use inc or, ft.")
    if(x=='feet'):
        print 'your conversion of yards to feet is:', yrds/0.33333333, \

    if(x=='inches'):
            print "Your conversion of yards to inches is", yrds*36, \


This is using python just so you know.

Is This A Good Question/Topic? 0
  • +

Replies To: How do I restart my program when its finished converting?

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5348
  • View blog
  • Posts: 27,305
  • Joined: 10-May 07

Re: How do I restart my program when its finished converting?

Posted 22 January 2012 - 11:57 PM

View Postmariomix10, on 23 January 2012 - 01:51 AM, said:

This is using python just so you know.

** moved to python **
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6066
  • View blog
  • Posts: 23,526
  • Joined: 23-August 08

Re: How do I restart my program when its finished converting?

Posted 23 January 2012 - 03:00 PM

Ummm...wrap the main routines in a loop?

x = input("What is the measurement type? Use inc, yrds or, ft. if you wish to quit, type q.")
if(x== 'quit'):
    print("Thankyou for useing this software")
    quit

Don't lie to your users. They need to type 'quit', not 'q'.
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5348
  • View blog
  • Posts: 27,305
  • Joined: 10-May 07

Re: How do I restart my program when its finished converting?

Posted 23 January 2012 - 06:35 PM

View PostJackOfAllTrades, on 23 January 2012 - 05:00 PM, said:

Don't lie to your users. They need to type 'quit', not 'q'.

ROFL!
#Aggravation ware 2.0
x = input("Press space to quit.")
if(x=='q'):
  print("Thank you for using this software")
  quit


Was This Post Helpful? 0
  • +
  • -

#5 mariomix10  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-January 12

Re: How do I restart my program when its finished converting?

Posted 23 January 2012 - 10:09 PM

View Postno2pencil, on 23 January 2012 - 06:35 PM, said:

View PostJackOfAllTrades, on 23 January 2012 - 05:00 PM, said:

Don't lie to your users. They need to type 'quit', not 'q'.

ROFL!
#Aggravation ware 2.0
x = input("Press space to quit.")
if(x=='q'):
  print("Thank you for using this software")
  quit


Oh god. LOL
Was This Post Helpful? 0
  • +
  • -

#6 mariomix10  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-January 12

Re: How do I restart my program when its finished converting?

Posted 23 January 2012 - 10:16 PM

View PostJackOfAllTrades, on 23 January 2012 - 03:00 PM, said:

Ummm...wrap the main routines in a loop?

x = input("What is the measurement type? Use inc, yrds or, ft. if you wish to quit, type q.")
if(x== 'quit'):
    print("Thankyou for useing this software")
    quit

Don't lie to your users. They need to type 'quit', not 'q'.

Such as... What? Sorry, I'm new to python scripting.
Was This Post Helpful? 0
  • +
  • -

#7 sysop_fb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-January 12

Re: How do I restart my program when its finished converting?

Posted 24 January 2012 - 01:23 PM

Such as a while loop which lets you loop a block of code an undefined number of times.

def main():
    x = raw_input("Hit q to quit: ")
    while(x != 'quit'):
        print("Haha you wish it was that easy!")
        x = raw_input("Hit q to quit: ")

main()


Was This Post Helpful? 0
  • +
  • -

#8 mariomix10  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-January 12

Re: How do I restart my program when its finished converting?

Posted 24 January 2012 - 10:51 PM

View Postsysop_fb, on 24 January 2012 - 01:23 PM, said:

Such as a while loop which lets you loop a block of code an undefined number of times.

def main():
    x = raw_input("Hit q to quit: ")
    while(x != 'quit'):
        print("Haha you wish it was that easy!")
        x = raw_input("Hit q to quit: ")

main()


Ok, now every time I run the program, it dosen't play the prompt.
q = 'quit'
ft = 'feet'
inc = 'inches'
yrds = 'yards'
def main():
    x = input("What is the measurement type? Use inc, yrds or, ft. if you wish to quit, type q.")
    while (x== 'quit'):
        print("Thankyou for useing this software")
        quit
    while(x=='feet'):
        ft=input("What distance in feet?")
        x = input("Convert feet into what? Use yrds, or inc")
        while(x=='inches'):
            print 'your conversion of feet to inches is:', ft/12, \
            main ()

        while(x=='yards'):
            print'your conversion of feet to yards is:', t*0.33333333, \
            main()

    while(x=='inches'):
        inc = input("What distance in inches?")
        x = input("Convert into what? Use ft, or yrds")
        while(x=='yards'):
            print 'your conversion of inches to yards is:', inc/36,
            main()

        while(x=='feet'):
            print 'Your conversion of inches to feet is:', inc/12, \
            main()

    while(x=='yards'):
        yrds = input('What distance in yards?')
        x = ('What is your conversion? Use ft, or inc.')
        while(x=='feet'):
            print 'your conversion of yards to feet is:', yrds/0.33333333, \
            main()

        while(x=='inches'):
            print "Your conversion of yards to inches is", yrds*36, \
            main()


Was This Post Helpful? 0
  • +
  • -

#9 mariomix10  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-January 12

Re: How do I restart my program when its finished converting?

Posted 24 January 2012 - 11:11 PM

View Postmariomix10, on 24 January 2012 - 10:51 PM, said:

View Postsysop_fb, on 24 January 2012 - 01:23 PM, said:

Such as a while loop which lets you loop a block of code an undefined number of times.

def main():
    x = raw_input("Hit q to quit: ")
    while(x != 'quit'):
        print("Haha you wish it was that easy!")
        x = raw_input("Hit q to quit: ")

main()


Ok, now every time I run the program, it dosen't play the prompt.
q = 'quit'
ft = 'feet'
inc = 'inches'
yrds = 'yards'
def main():
    x = input("What is the measurement type? Use inc, yrds or, ft. if you wish to quit, type q.")
    while (x== 'quit'):
        print("Thankyou for useing this software")
        quit
    while(x=='feet'):
        ft=input("What distance in feet?")
        x = input("Convert feet into what? Use yrds, or inc")
        while(x=='inches'):
            print 'your conversion of feet to inches is:', ft/12, \
            main ()

        while(x=='yards'):
            print'your conversion of feet to yards is:', t*0.33333333, \
            main()

    while(x=='inches'):
        inc = input("What distance in inches?")
        x = input("Convert into what? Use ft, or yrds")
        while(x=='yards'):
            print 'your conversion of inches to yards is:', inc/36,
            main()

        while(x=='feet'):
            print 'Your conversion of inches to feet is:', inc/12, \
            main()

    while(x=='yards'):
        yrds = input('What distance in yards?')
        x = ('What is your conversion? Use ft, or inc.')
        while(x=='feet'):
            print 'your conversion of yards to feet is:', yrds/0.33333333, \
            main()

        while(x=='inches'):
            print "Your conversion of yards to inches is", yrds*36, \
            main()


... Oh nvm, Just re read your last comment, I'm good. Thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1