Generation

generate functionThu, 20 Jul 2023

Faça um programa que pede duas variáveis, e informe quais são ímpares e quais são pares

def odd_even(a, b): if a % 2 == 0: even_a = True else: even_a = False if b % 2 == 0: even_b = True else: even_b = False if even_a and even_b: return 'Both are even' if not even_a and not even_b: return 'Both are odd' if not even_a and even_b: return 'First number is odd and the second is even' if even_a and not even_b: return 'First number is even and the second is odd' odd_even(1, 2)

Questions about programming?Chat with your personal AI assistant