Пожалуйста Языком Пайтон,даю много балов

1.Напишіть програму, щоб перевірити, чи є введене число додатним, від’ємним або це нуль.

Вхідні дані:

7
-5.6
0
2.Дано радіус кола і сторона квадрата (дійсні числа). У якої фігури площа більше?

Вхідні дані:

2.5
3.5
3.6
7.5

3.Користувачем вводиться два імені. Використовуючи конструкцію розгалуження програма повинна вивести імена в алфавітному порядку.

Вхідні дані:

Guido van Rossum
Dennis Ritchie

4.Дано трицифрове число. Визначити, чи рівний квадрат суми цифр числа сумі кубів його цифр.

Вхідні дані:

123
210
150​

Ответы

Ответ дал: kent228one
0

Відповідь:

Перевірка знаку числа:

number = float(input("Enter a number: "))

if number > 0:

print("The number is positive")

elif number < 0:

print("The number is negative")

else:

print("The number is zero")

Порівняння площ фігур:

import math

radius = float(input("Enter the radius of the circle: "))

side = float(input("Enter the side of the square: "))

circle_area = math.pi * radius ** 2

square_area = side ** 2

if circle_area > square_area:

print("The area of the circle is greater")

elif circle_area < square_area:

print("The area of the square is greater")

else:

print("The areas are equal")

Сортування двох імен в алфавітному порядку:

name1 = input("Enter the first name: ")

name2 = input("Enter the second name: ")

if name1 < name2:

print(name1, name2)

else:

print(name2, name1)

Перевірка на рівність квадрату суми цифр і сумі кубів цифр:

number = input("Enter a three-digit number: ")

digit1 = int(number[0])

digit2 = int(number[1])

digit3 = int(number[2])

sum_of_digits = digit1 + digit2 + digit3

sum_of_cubes = digit1 ** 3 + digit2 ** 3 + digit3 ** 3

if sum_of_digits ** 2 == sum_of_cubes:

print("The square of the sum of the digits is equal to the sum of the cubes of the digits")

else:

print("The square of the sum of the digits is not equal to the sum of the cubes of the digits")

Пояснення:

Вас заинтересует