Last answered:

21 Nov 2022

Posted on:

19 Nov 2022

0

Practice challenge (if condition): question 5

I have solved the question 5 with some other lines of code:

code>>>

integer1 = input('please write the first integer between 1-20: ')
integer2 = input('please write the second integer between 1-20: ')
if integer1.isdigit() and integer2.isdigit():
    integer1, integer2 = int(integer1), int(integer2)
    if integer1 and integer2 > 15:
        print(integer1 * integer2)
    elif integer1 > 15 or integer2 > 15:
        print(integer1 + integer2)
    else:
        print(0)
else:
    print('this is not even an integer')

>>> is this syntax correct?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

21 Nov 2022

1

Hey Mohamed,

Thank you for sharing your code with the community!

To me, this seems like a perfectly working solution. Keep up the good work!

Kind regards,
365 Hristina

Submit an answer