Предмет: Информатика, автор: papappaa

Створіть програму для знаходження максимального парного елементу масиву та максимального непарного елементу масиву. Масив з 10 цілих чисел користувач вводить з клавіатури. 100 балів

Ответы

Автор ответа: david7833jdhdhdbsb
3

Ответ:

a = []

for i in range(10):

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

a.append(num)

max_even = float('-inf')

max_odd = float('-inf')

for num in a:

if num % 2 == 0 and num > max_even:

max_even = num

elif num % 2 != 0 and num > max_odd:

max_odd = num

if max_even == float('-inf'):

print("Введений масив не містить парних чисел.")

else:

print("Максимальний парний елемент масиву:", max_even)

if max_odd == float('-inf'):

print("Введений масив не містить непарних чисел.")

else:

print("Максимальний непарний елемент масиву:", max_odd)

Похожие вопросы
Предмет: Английский язык, автор: cherkasovaeva21
Предмет: Английский язык, автор: OlezhkaVolkoVolkov
1. Last night I _________ my tickets.
buyed
bought
didn’t bought
2. She _________ a picture yesterday.
drawed
drew
draw
3. We _________ sweets last night.
didn’t ate
eaten
ate
4. She _________ at a concert a year ago.
sang
sing
song
5. Her little sister _________ orange juice two days ago.
drank
drink
drynk

Task 2. Make the sentences negative. (сделай предложения отрицательными)
1. Mum ate a chocolate cake last weekend. Mum _______ a chocolate cake last weekend.
2. Children sang songs at the birthday party a week ago. Children _______ songs at the birthday party a week ago.
3. Dennis bought a new table a month ago. Dennis _______ a new table a month ago.
4. Pete went to the gallery last Thursday. Pete _______ to the gallery last Thursday.
5. I slept in the afternoon yesterday. I _______ in the afternoon yesterday.

Task 3. Answer the questions. (ответь на вопросы)
(✗) – ответ отрицательный (✓) –ответ утвердительный
1. Did they buy TV yesterday? (✗) – ________________________________________________.
2. Did you meet Sam at the theatre last month? (✓) – ___________________________________
3. Did they drink a glass of milk last night? (✗) – ______________________________________
4. Did Simba write a letter two weeks ago? (✗) – ______________________________________
5. Did Andrew ride a horse last year? (✓) – ___________________________________________
Name ______________________________________Form 4 ________ Date ______ List 2
Test 4_1 ​​Variant 1

Task 4. Ask questions with Did. (задай вопросы)

1. Ben saw a plane. _____________________________________________________________
2. Manny wrote a lot of letters. ___________________________________________________
3. Lena took the passport. _______ _________________________________________________
4. Alice bought a lot of things. ____________________________________________________
5. We sang songs last Saturday.____________________________________________________

Task 5. Cross out extra words. (зачеркни лишние слова)
1. He goes always slept in the bed yesterday night.
2. The monkey is saw sees a banana one minute ago.
3. Peter didn’t not go to school a week ago.
4. The now dinosaurs is ate eating meat many years ago.
5. Alex didn’t bought a sandwich 5 minutes ago.

Task 6. Make the sentences and translate all the sentences.
(составь предложения и переведи их)

1. Mike/ went/ to the/ funfair/ with/ his/ friends/ last/ month .
_____________________________________________________________________________
2. concert/ a lot of/ Pete/ sang/ at the/ yesterday/ songs/ night .
_____________________________________________________________________________
3. book/ last/ write/ Robert/ at home/ a new/ week/ Did?
_____________________________________________________________________________
Предмет: История, автор: MUDROSTRU