Here's my upper code:(30 minutes)
if (lengthofflight == 30) and (typeofplane == x) or (typeofplane == y) or (typeofplane == z):
if (typeofplane == x) and (typeofplane != y and z):
timewastedonchecks = (10 * 60) - (30 * 10)
maximumnumberofflight = timewastedonchecks / lengthofflight
maximumnumberofincome = maximumnumberofflight * 100
print("The maximum number of flight is ", int(maximumnumberofflight), "for ", typeofplane)
print("The maximum number of income is $", int(maximumnumberofincome), "for", typeofplane,
"of length of flight of 30 minutes")
elif (typeofplane == y) and (typeofplane != x and z):
timewastedonchecks = (10 * 60) - (30 * 10)
maximumnumberofflight = timewastedonchecks / lengthofflight
maximumnumberofincome = maximumnumberofflight * 120
print("The maximum number of flight is ", int(maximumnumberofflight), "for ", typeofplane)
print("The maximum number of income is $", int(maximumnumberofincome), "for", typeofplane,
"of length of flight of 30 minutes")
elif (typeofplane == z) and (typeofplane != y and x):
timewastedonchecks = (10 * 60) - (30 * 10)
maximumnumberofflight = timewastedonchecks / lengthofflight
maximumnumberofincome = maximumnumberofflight * 300
print("The maximum number of flight is ", int(maximumnumberofflight), "for ", typeofplane)
print("The maximum number of income is $", int(maximumnumberofincome), "for", typeofplane,
"of length of flight of 30 minutes")
This upper code will produce for the amount of income collected and number of flights for every 30 minutes. I need to make the exact same one but this time 60 minutes. So here's a sample of the 60 minutes code:( 60 minutes)
if (lengthofflight == 60) and (typeofplane == x) or (typeofplane == y) or (typeofplane == z):
if (typeofplane == x) and (typeofplane != y and z):
timewastedonchecks = (10 * 60) - (30 * 10)
maximumnumberofflight = timewastedonchecks / lengthofflight
maximumnumberofincome = maximumnumberofflight * 150
print("The maximum number of flight is ", int(maximumnumberofflight), "for ", typeofplane)
print("The maximum number of income is $", int(maximumnumberofincome), "for", typeofplane,
"of length of flight of 60 minutes")
Both of these code are correct,I put this 2nd code below the 1st code and it is not under the same if clause.
However, when I input 60 minutes, it won't calculate the number of flights and the amount of income received.
So python doesn't get my 2nd group of code(60 minutes)
I couldn't find my mistake and is there any other code that could shorten the code but still produce the same data?
Edit: Nvm, it worked in Jupyter Notebook but it doesn't work in Pycharm. So can anyone please tell me what is the difference? I copied and pasted from Jupyter notebook to Pycharm and yet it didn't work.
Aucun commentaire:
Enregistrer un commentaire