i got the first 2 tasks done, i need help on the third.
here is the third task...at first glance it seems simple. to me it is actually difficult and someone please help. any help is appreciated. thanks in advance.
i tried to have my variables num1 and num2 get added together, the print statement looked like this: print(num1 + num2), and the answer it gave me is just putting num1 in front of num2. i entered 6 for num1 and 9 for num2, when it gave me my answer it claims that 6 + 9 = 69. what the heck? last time i checked, 6 + 9 = 15.@Coder100
Oh, on line
The thing is you forgot to convert it into a
int so it was still a string and concatenated the strings.
Here's the correct code:
if num1.isdigit() and num2.isdigit(): print(int(num1) + int(num2)) elif num1.isalpha() and num2.isalpha(): print("You did not enter a valid number") elif num1.isdigit() and num2.isalpha(): print("You entered only one valid number") elif num1.isalpha() and num2.isdigit(): print("You entered only one valid number") else: print("Do you even know what a number is? ")