I have been learning to code in Python, and I think that I have learnt a lot so far. However, I have a small doubt regarding the ".isdigit()" command. For starters, it seems to only detect whole numbers, and treats all other types as strings. Please tell me alternative codes that I could use.
My current code (for reference):
Valid_Integer = False
while not Valid_Integer:
addend1 = input("\nEnter Addend #1: ")
if addend1.isdigit():
Valid_Integer = True
else:
print("Please enter a number...")
Valid_Integer = False
while not Valid_Integer:
addend2 = input("Enter Addend #2: ")
if addend2.isdigit():
Valid_Integer = True
else:
print("Please enter a number...\n")_
result_add = float(addend1) + float(addend2)
print("\nThe Sum is: ",result_add)