Python Forum
question regarding user Inputs
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question regarding user Inputs
#10
here is the latest code I've done. I need to clean it up some more but just thought I'd post it up. Also fishing for pointers or advice on how it looks so far.

import random
 
good_bye = ['A goodbye isn’t painful unless you’re never going to say hello again.', 'A man never knows how to say goodbye; a woman never knows when to say it.',
            'As contraries are known by contraries, so is the delight of presence best known by the torments of absence.', 'Be well, do good work, and keep in touch.',
            'Being strong sometimes means being able to let go.', 'But fate ordains that dearest friends must part.', 'All those moments will be lost in time, like tears in rain.']
 
def Conversion_type():
    while True:
        P1 = input("Is your conversion:[1]ML and OZ, [2] C and F, [3]Grams and OZ, [4]SG and API, [5] SG to PPG, [Q] to quit ")
        print (P1)
 
        if P1 == "1":
            Fluid_converter()
        elif P1 == "2":
            Temp_converter()
        elif P1 == "3":
            Grams_ounces()
        elif P1 == "4":
            API_Specific_gravity()
        elif P1 == "5":
            SG_PPG()
        elif P1.lower == "q":
            quit()
 
def Fluid_converter():
 
    while True:
        P1 = input("Convert to ML,OZ (select one), 'Q'=quit: ")
        print (P1)
 
 
        if P1.lower() == "ml":
            Volume = float(input("What is your Volume?"))
            answer = (Volume / 29.5735296)
            print(round(answer, 4))
        elif P1.lower() == "oz":
            Volume = float(input("What is your Volume?"))
            answer = (Volume * 29.5735296)
            print(round(answer, 4))
        elif P1.lower() == 'q':
            break
 
def Temp_converter():
    while True:
        P1 = input("Convert to C,F (select one), 'Q'=quit: ")
        print (P1)
 
        if P1.lower() == "c":
            Temp = float(input("What is your temperature?"))
            print(((Temp) * (9/5)) + 32)
        elif P1.lower() == "f":
            Temp = float(input("What is your temperature?"))
            print(((Temp) - 32) * (5/9))
        elif P1.lower() == 'q':
            break
 
def grams_ounces():
    while True:
        P1 = input("Convert to G,OZ (select one), 'Q'=quit: ")
        print (P1)
 
 
        if P1.lower() == "g":
            mass = float(input("What is your mass?"))
            answer = ((mass) / 28.35)
            print(round(answer, 4))
        elif P1.lower() == "oz":
            mass = float(input("What is your mass?"))
            answer = ((mass) * 28.35)
            print(round(answer, 4))
        elif P1.lower() == 'q':
            break
 
def API_Specific_gravity():
    while True:
        P1 = input("Convert [API] and [SG] (select one), 'Q'=quit: ")
        print (P1)
 
        if P1.lower() == "api":
            value = float(input("What is your value?"))
            answer = ((141.5)/((value)+ 131.5))
            print(round(answer, 4))
        elif P1.lower() == "sg":
            value = float(input("What is your value SG?"))
            answer = (((141.5)/(value)) - 131.5)
            print(round(answer, 4))
        elif P1.lower == 'q':
            break
                     
 
def SG_PPG():
 
    while True:
        P1 = input("SG or PPG, 'Q'=quit: ")
        print (P1)
 
 
        if P1.lower() == "sg":
            Value = float(input("What is your Value?"))
            answer = ((Value) * 8.33)
            print(round(answer, 4))
        elif P1.lower() == "ppg":
            Value = float(input("What is your Value?"))
            answer = (Value / 8.33)
            print(round(answer, 4))
        elif P1.lower() == 'q':
            break
 
print("Let's get this party started!")
Conversion_type()
print((random.choice)(good_bye))
Reply


Messages In This Thread
question regarding user Inputs - by cibb - Mar-30-2017, 02:36 AM
RE: question regarding user Inputs - by wavic - Mar-30-2017, 03:29 AM
RE: question regarding user Inputs - by cibb - Mar-30-2017, 01:53 PM
RE: question regarding user Inputs - by wavic - Mar-30-2017, 02:21 PM
RE: question regarding user Inputs - by cibb - Mar-30-2017, 05:14 PM
RE: question regarding user Inputs - by wavic - Mar-30-2017, 05:27 PM
RE: question regarding user Inputs - by cibb - Mar-30-2017, 05:49 PM
RE: question regarding user Inputs - by wavic - Mar-30-2017, 07:25 PM
RE: question regarding user Inputs - by cibb - Mar-31-2017, 02:56 AM
RE: question regarding user Inputs - by cibb - Apr-02-2017, 07:08 PM
RE: question regarding user Inputs - by alicarlos13 - Apr-04-2017, 03:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to write a response if a user inputs a string horuscope42 3 2,278 Apr-29-2020, 03:39 PM
Last Post: deanhystad
  Perminantly saving user inputs + being able to retrieve it ThatOneGuyNoOneKnowsCodes 1 1,986 Oct-23-2019, 11:28 PM
Last Post: DT2000
  Trying to prompt user for 2 inputs on one line pythonprogrammer 2 2,548 Sep-15-2019, 04:41 PM
Last Post: snippsat
  user inputs in constructing a dictionary Exsul 3 3,744 Apr-10-2019, 12:25 PM
Last Post: ichabod801
  unit testing a method that asks two user inputs() in console gebel 0 2,178 Apr-03-2019, 07:59 PM
Last Post: gebel
  User input question linuxnoob 9 5,061 Jul-12-2018, 01:56 PM
Last Post: linuxnoob
  code that takes inputs for user name amounts etc and then sends custom message shaumyabrata 5 5,380 Feb-12-2017, 11:37 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020