Skip to content

Commit bbc4eca

Browse files
Session 3 and Session 1 Questions
Signed-off-by: Chandra Prakash S <[email protected]>
1 parent f19b247 commit bbc4eca

File tree

3 files changed

+86
-1
lines changed

3 files changed

+86
-1
lines changed

Session-1/volumeofsphere.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
vol = (4/3)*pi*r*r*r
1010
print(str(vol))
1111

12-
# Output needs further formatting.

Session-3/akashisadiehardfan.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""
2+
Problem Description:
3+
Akash the die heart fan of AR Rahman went to the live concert happened in Bangalore with his family members.
4+
The event management firm responsible for the event arranged the seats for the audience in descending order of maximum number of tickets booked for single family.
5+
As per the seating arrangement family with the highest number of people are allotted the seats in the front rows and the family with the lowest number of people are allotted the seats in the last row.
6+
For the convenience of the seating arrangement volunteers to know how many seat need to be positioned in each row the event management firm have planned to develop the software which displays the exact seat layout if the total number of rows is provided.
7+
Can you help them with the logic of doing so?
8+
Constraints:
9+
1 ≤ nooffamilymembers ≤ 20
10+
Input Format:
11+
Only line of input has single integer representing the total number of rows for the concert.
12+
Output Format:
13+
Print the seating arrangement layout based on the number of rows provided.
14+
Refer sample testcases for format specification.
15+
16+
Logical Test Cases
17+
Test Case 1
18+
INPUT (STDIN)
19+
11
20+
EXPECTED OUTPUT
21+
11 11 11 11 11 11 11 11 11 11 11
22+
10 10 10 10 10 10 10 10 10 10
23+
9 9 9 9 9 9 9 9 9
24+
1
25+
Test Case 2
26+
INPUT (STDIN)
27+
8
28+
EXPECTED OUTPUT
29+
8 8 8 8 8 8 8 8
30+
7 7 7 7 7 7 7
31+
6 6 6 6 6 6
32+
5 5 5 5 5
33+
4 4 4 4
34+
3 3 3
35+
2 2
36+
1"""
37+
38+
num_rows = int(input())
39+
40+
for i in range(num_rows):
41+
num_seats = num_rows - i
42+
row_layout = [num_seats] * num_seats
43+
print(*row_layout, end=" ")
44+
print()

Session-3/thanosandironman.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""
2+
Question description
3+
Thanos and iron man had a challenge to get the stones from Hulk. But Hulk gave the task to them. They need to display the even and odd numbers separately from the numbers.
4+
Input Format:
5+
First value is the size of the array.
6+
Second value onwards the numbers which will be separated as even and odd.
7+
8+
Logical Test Cases
9+
Test Case 1
10+
INPUT (STDIN)
11+
3
12+
22
13+
50
14+
11
15+
EXPECTED OUTPUT
16+
22 50
17+
11
18+
Test Case 2
19+
INPUT (STDIN)
20+
5
21+
2
22+
4
23+
6
24+
5
25+
1
26+
EXPECTED OUTPUT
27+
2 4 6
28+
5 1
29+
"""
30+
n = int(input())
31+
even = []
32+
odd = []
33+
for i in range(n):
34+
num = int(input())
35+
if num % 2 == 0:
36+
even.append(num)
37+
else:
38+
odd.append(num)
39+
print(*even, end=' ')
40+
print()
41+
print(*odd, end=' ')
42+
print()

0 commit comments

Comments
 (0)