I have created a python program for basic unit conversion.
This is what that I have created:
print("
-: A Simple Application for Convert Liter(L) to Cubic-centimeter(cc/cmu00B3) :-")
print(' ', ("u207B" * 71))
value = input("
Enter the value (in L): ");
if '.' in value:
try:
value = float(value)
print('
==>', value,'L is equal to', value * 1000, 'cc/cmu00B3.')
input("
Thanks for use me :)
Hope it helped you!
Press 'ENTER' key to exit........")
except:
print('
', "
Something went wrong! :(")
print('
', " Exit and Try again! [make sure you'r entering a Integer value or Float Value]")
input("
Press 'ENTER' key to exit........")
else:
try:
value = int(value)
print('
==>', value,'L is equal to', value * 1000, 'cc/cmu00B3.')
input("
Thanks for use me :)
Hope it helped you!
Press 'ENTER' key to exit........")
except:
print('
', " Something went wrong! :(")
print('
', " Exit and Try again! [make sure you'r entering a Integer Value or Float Value]")
input("
Press 'ENTER' key to exit........")
Now I want to repeat my program again based on user input.
Basically what I'm trying to do:
after showing answer or showing this print('
', " Something went wrong! :("); it will asks user for repeat this. If value for yes = y OR Y, It will repeat the program from the beginning.
If value for no = n OR N, It will stop after showing output of this input("
Thanks for use me :)
Press 'ENTER' key to exit........").
If value is not equal to 'n', 'N' or 'y', 'Y' , It will show Invalid Input!
And above those two condition (1) and (2) will be inside in both try and except statement.
Anyone help please??