Вопрос задан 23.11.2023 в 16:41. Предмет Информатика. Спрашивает Лещенко Виктория.

Пожалуйста Языком Пайтон,даю много балов 1.Напишіть програму, щоб перевірити, чи є введене число

додатним, від’ємним або це нуль.Вхідні дані:7-5.602.Дано радіус кола і сторона квадрата (дійсні числа). У якої фігури площа більше?Вхідні дані:2.53.53.67.53.Користувачем вводиться два імені. Використовуючи конструкцію розгалуження програма повинна вивести імена в алфавітному порядку.Вхідні дані:Guido van RossumDennis Ritchie4.Дано трицифрове число. Визначити, чи рівний квадрат суми цифр числа сумі кубів його цифр.Вхідні дані:123210150​ ​
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Карпов Андрей.

1

num = int(input("Введіть число: "))

if (num > 0):

   print(num," > 0")

elif (num < 0):

   print(num," < 0")

   

else:

   print(num," == 0")

2

a,b=map(float,input().split())

if a*a<b**2*3.14:

 print('Круг')

else:

  print('Квадрат')

3

f = input("Введіть імена (через кому): ")

massiv=f.split(",")

length = len(massiv)

for i in range(length):

  for j in range(0, length-i-1):

      if massiv[j] > massiv[j+1]:

          massiv[j],massiv[j+1]=massiv[j+1],massiv[j]

for i in massiv:

   print(i)

4

num = int(input("Введіть трицифрове число: "))

a = num // 100  

b = (num % 100) // 10  

c = num % 10  

sum_of_digits = a + b + c  

square_of_sum = sum_of_digits**2

sum_of_cubes = a**3 + b**3 + c**3  

if square_of_sum == sum_of_cubes:  

   print("Квадрат суми цифр дорівнює сумі кубів його цифр.")  

else:                              

   print("Квадрат суми цифр не дорівнює сумі кубів її цифр.")

Таби могли збитись, тому не забудьте перевірити роботоспособність програми :)

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

1. To write a program in Python that checks whether a given number is positive, negative, or zero, you can use an if-elif-else statement. Here's an example:

```python 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.") ```

2. To determine which shape has a larger area between a circle and a square, given the radius of the circle and the side length of the square, you can calculate the areas of both shapes and compare them. Here's an example:

```python import math

radius = float(input("Enter the radius of the circle: ")) side_length = float(input("Enter the side length of the square: "))

circle_area = math.pi * radius ** 2 square_area = side_length ** 2

if circle_area > square_area: print("The area of the circle is larger.") elif circle_area < square_area: print("The area of the square is larger.") else: print("The areas are equal.") ```

3. To input two names from the user and display them in alphabetical order using a branching construct, you can use the `sorted()` function. Here's an example:

```python name1 = input("Enter the first name: ") name2 = input("Enter the second name: ")

sorted_names = sorted([name1, name2])

print("The names in alphabetical order are:", sorted_names[0], sorted_names[1]) ```

4. To determine if the square of the sum of the digits of a three-digit number is equal to the sum of the cubes of its digits, you can extract the digits, calculate the square of the sum and the sum of the cubes, and compare them. Here's an example:

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

digit1 = number // 100 digit2 = (number // 10) % 10 digit3 = number % 10

sum_of_digits = digit1 + digit2 + digit3 square_of_sum = sum_of_digits ** 2 sum_of_cubes = digit1 3 + digit2 3 + digit3 ** 3

if square_of_sum == sum_of_cubes: print("The square of the sum of the digits is equal to the sum of the cubes.") else: print("The square of the sum of the digits is not equal to the sum of the cubes.") ```

Please note that the above programs assume valid input from the user and do not include error handling.

0 0

Похожие вопросы

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос