a = float("Enter the required amount:")
c = float("Enter the conversion factor: ")))
def ZEB():
n = print(a * c)
if n < 80:
print ("Grade is A")
elif 80 <= n < 140:
print ("Grade B"")
elif n >= 140:
print ("Not eligible for conditions")
else:
I wrote the code, but it's calculated up to a and c, but it's not executed from the next function.
The error does not appear, but only Remote Python engine is active
appears. Could you tell me what I did wrong and which part I missed?
I'm not sure about the "Remote Python engine is active" error, but I'll check it only grammatically.
#Grammar incorrect
# If you're going to do it, write it in the form of elif 80 <= n < 140
elif 80 <= n < 140:
print ("Grade B"")
elif n >= 140:
print ("Not eligible for conditions")
else:
# There needs to be some sort of processing here, but there's no problem
Would you like to replace the code above with the code below and try again?
# By the way, n >= 80 check is not required here
# (If this part is executed, it means n < 80 is not elif)
elif n < 140:
print ("Grade B"")
# No need to check n >= 140 on the same principle
# Since there are only two thresholds to examine n (80, 140), it can be handled with the concept of 'any other case'
else:
# Put something under the else block
# I'm glad this solves the problem
print ("Not eligible for conditions")
a = float("Enter the required amount:")
c = float("Enter the conversion factor: ")))
def ZEB():
n = a * c
print(n)
if n < 80:
print ("Grade is A")
elif 80 <= n < 140:
print ("Grade B"")
elif n >= 140:
print ("Not eligible for conditions")
ZEB()
print(a*c) is a NoneType rather than int, so it cannot be compared with if. Therefore, it is solved by substituting a*c for n as above.
© 2024 OneMinuteCode. All rights reserved.