Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import ceil
- n = int(input())
- children = []
- adults = []
- for i in range(n):
- person_age = int(input())
- if person_age > 135:
- print(f"System was hacked with {person_age} \n List - []")
- elif 18 <= person_age <= 135:
- adults.append(person_age)
- elif person_age < 18:
- children.append(person_age)
- count_children = len(children)
- count_adults = len(adults)
- average_adult_age = ceil(sum(adults) / count_adults)
- print(children)
- print(adults)
- print(f"Count of children: {count_children}")
- print(f"Count of adults: {count_adults}")
- print(f"Average age of adults: {average_adult_age}")
- positive = []
- negative = []
- odd = []
- even = []
- n = int(input())
- for i in range(n):
- num = int(input())
- if num % 2 == 0:
- even.append(num)
- else:
- odd.append(num)
- if num > 0:
- positive.append(num)
- else:
- negative.append(num)
- command = input("Enter command: ")
- if command == "positive":
- print(f"Numbers {command}: {sorted(positive)}")
- elif command == "negative":
- print(f"Numbers {command}: {sorted(negative)}")
- elif command == "odd":
- print(f"Numbers {command}: {sorted(odd)}")
- elif command == "even":
- print(f"Numbers {command}: {sorted(even)}")
- data = input().split(", ")
- int_list = []
- for i in data:
- current_element = int(i)
- int_list.append(current_element)
- int_list.sort()
- str_list = []
- for i in int_list:
- current_element = str(i)
- str_list.append(current_element)
- average_points = sum(int_list) / len(int_list)
- print(f"Sorted list of points {' - '.join(str_list)}")
- print(f"Count of plays: {len(int_list)}")
- print(f"Worst play: {min(int_list)}")
- print(f"Best play: {max(int_list)}")
- print(f"Average points: {ceil(average_points)}")
- grades = input().split(", ")
- grades_list = []
- for i in grades:
- current_element = int(i)
- grades_list.append(current_element)
- grades_list.sort()
- str_list = []
- for i in grades_list:
- current_element = str(i)
- str_list.append(current_element)
- average_points = sum(grades_list) / len(grades_list)
- print(f"Reverse sorted list of evaluations: {' '.join(str_list)}")
- print(f"Count of evaluations: {len(grades_list)}")
- print(f"Worst evaluation: {min(grades_list)}")
- print(f"Best evaluation: {max(grades_list)}")
- print(f"Count of sixes: {grades_list.count(6)}")
- print(f"Average evaluations: {average_points}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement