Как-то так:
1. Задание
a = int(input("Enter the value of a: "))
b = int(input("Enter the value of b: "))
if (a >= 0 and b >= 0) or (a < 0 and b < 0):
print("YES")
else:
print("NO")
2. Задание
num = int(input("Enter a four-digit number: "))
if num < 1000 or num > 9999:
print("Invalid number")
tens_digit = num // 10 % 10
if tens_digit % 2 == 1:
3. Задание
A = int(input("Enter the cost of the book in UAH: "))
B = int(input("Enter the cost of the book in COP: "))
C = int(input("Enter the amount Tanya has in UAH: "))
D = int(input("Enter the amount Tanya has in COP: "))
book_cost = A * 100 + B
tanya_money = C * 100 + D
if tanya_money >= book_cost:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Как-то так:
1. Задание
a = int(input("Enter the value of a: "))
b = int(input("Enter the value of b: "))
if (a >= 0 and b >= 0) or (a < 0 and b < 0):
print("YES")
else:
print("NO")
2. Задание
num = int(input("Enter a four-digit number: "))
if num < 1000 or num > 9999:
print("Invalid number")
else:
tens_digit = num // 10 % 10
if tens_digit % 2 == 1:
print("YES")
else:
print("NO")
3. Задание
A = int(input("Enter the cost of the book in UAH: "))
B = int(input("Enter the cost of the book in COP: "))
C = int(input("Enter the amount Tanya has in UAH: "))
D = int(input("Enter the amount Tanya has in COP: "))
book_cost = A * 100 + B
tanya_money = C * 100 + D
if tanya_money >= book_cost:
print("YES")
else:
print("NO")