by CodeChum Admin
Instructions:
Input
The first line contains an integer n which is the size of the array.
The next n lines contains a string on each.
The last line contains an integer which is the index to be accessed and printed.
6
Learning
Programming
made
easy
with
Cody!
5
Output
A line containing a string.
Cody!
by CodeChum Admin
Counting off a list of decimal numbers is hard when you speak it, but not when you code it! Don't believe me? Then let's try coding just that!
Instructions:
Output
Multiple lines containing a decimal number.
5.1
5.5
4.00001
4.024
3.0
3.66
2.5
2.2
1.2054
1.4
by CodeChum Admin
You can also make a list of numbers, ey? Let's go and have some fun in tweaking the values of each element, but let's give it some twist to add on some fun to the code.
Let's have a go at it!
Instructions:
Output
The squares and cubes of the elements in the array.
4
1
1
8
27
.
.
.
by CodeChum Admin
Lists are fun to make, but it's even better to add or remove things from it when it's not usable anymore, right? Let's do just that in this problem now!
Instructions:
Input
Two lines containing a string.
fun
Python
Output
A line containing a string.
Python is really fun
We've been dealing with integers too much, it's time for decimals to shine!
Instructions:
Input
A line containing five decimal numbers separated by a space.
1.1·1.2·1.3·1.4·1.1
Output
The first line contains all the inputted decimal numbers separated by a space.
The second line contains a string which is the result.
1.1·1.2·1.3·1.4·1.1
Yes
First Prime Number
You are given N inputs. Write a program to print the first prime number in the given inputs.
Input
The first line of input is an integer N. The next N lines each contain an integer. Explanation
In the given example of
5 integers
1
10
4
3
2
The output should be
3.
Sample Input 1
5
1
10
4
3
2
Sample Output 1
3
Sample Input 2
4
2
3
5
7
Sample Output 2
2
Average of Given Numbers
You are given space-separated integers as input. Write a program to print the average of the given numbers.
Input
The first line of input contains space-separated integers.
Output
The output should be a float value rounded up to two decimal places.
Explanation
In the example, input is
1, 0, 2, 5, 9, 8. The sum of all numbers present in the list is 25, and their average is 25/6.
So, the output should be
4.17.
Sample Input 1
1 0 2 5 9 8
Sample Output 1
4.17
Sample Input 2
1 2 3 4 5
Sample Output 2
3.0
Reverse the sentence
your are given a string S as input , write a program to print the string after reversing words of the given sentence.
the first line of input is S.
in the given example the sentence "This is Python" contain 3 words ,when reversing the word "Python" comes to the starting of the sentence and "This" goes to the last of the sentence ,the word "is" remains in the same position.
so the output should be Python is This.
SAMPLE INPUT 1
This is Python
OUTPUT :- Python is This
SAMPLE INPUT 2
Hi! World Hello
OUTPUT:- Hello World Hi!
You are given a square matrix A of dimensions NxN and an integer X which means is an element of A, write a program to find P by performing the following table
(Use Big O to calculate the following time complexity)
Q 1
def printPairs(array):
for i in array:
for j in array:
print(str(i)+","+str(j))
Q2
def printUnorderedPairs(array):
for i in range(0,len(array)):
for j in range(i+1,len(array)):
print(array[i] + "," + array[j])
#Question3
def printUnorderedPairs(arrayA, arrayB):
for i in range(len(arrayA)):
for j in range(len(arrayB)):
if arrayA[i] < arrayB[j]:
print(str(arrayA[i]) + "," + str(arrayB[j]))
arrayA = [1,2,3,4,5]
arrayB = [2,6,7,8]