Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

numbers in string 2 :

if I given string is " I am 25 years and 10 months old " the numbers are 25 , 10 . code should print sum of the numbers 35, avg of the numbers 17.5 in the new line.

but if my input is Anjali25 is python4 the output should be sum of numbers 29 , avg of the numbers 14.5

how to write the program for this input Anjali25 is python4... have to check character by character...


Create and Print List -3:

You are given N numbers as input. Create a list and add the N numbers which are given as input and print the list.



Input:

The first line of input is an integer N. The next N lines each contain an integer.

Explanation:

In the given example,

N=4 and the numbers are 1, 2, 3, 4. So, the output should be [ 1, 2, 3, 4 ]

Sample Input 1

4

1

2

3

4

Sample Output 1

[1, 2, 3, 4]

Sample Input 2

3

13

21

19

Sample Output 2

[13, 21, 19]


can i get code without using append by using +operator



Given list sorting array and same frequency



Input:



[2 6 3 1 8 12 2 9 10 3 4]



Output:



[1 2 2 3 3 4 6 8 9 10 12]



2 3

Create and Print List -3:

You are given N numbers as input. Create a list and add the N numbers which are given as input and print the list.


Input:

The first line of input is an integer N. The next N lines each contain an integer.

Explanation:

In the given example,

N=4 and the numbers are 1, 2, 3, 4. So, the output should be [ 1, 2, 3, 4 ]

Sample Input 1

4

1

2

3

4

Sample Output 1

[1, 2, 3, 4]

Sample Input 2

3

13

21

19

Sample Output 2

[13, 21, 19]


can i get code without using append


Sanjay is recruited in Infosys company as a python developer. The company assigned him a software development task to build a compiler. Sanjay identifies that for compiler designing he need to implement tokenization of a specific line of program. As a friend of Sanjay, your task is to help him to write a python function Tokenize_Line(fname, n) (Refer RollNo_W11A_2.py )which reads nth line from prime.py file and returns a list containing all tokens of that line as shown in the example. Also, handle the possible exception and provide proper message.







Contents of prime.py file will be like:




from math import sqrt




n = 1




prime_flag = 0




if(n > 1):




for i in range(2, int(sqrt(n)) + 1):




if (n % i == 0):




prime_flag = 1




break




if (prime_flag == 0):




print("true")




else:




print("false")




else:




print("false")

You are given a file read.txt which contains some lines. As a python developer, you need to write a python function Read_Contents(fname, n) (Refer RollNo_W11A_1.py )which takes the name of the files and number of lines to be read from file. The function returns those lines in a string as shown in example.



Contents of read.txt file will be like:



This is python Lab.



The is the program for file handling.



Reading first n lines !

What is library in python?

Matrix Rotation

You're given a square matrix A of dimentions N X n. You need to apply below 3 operations.

Rotation: It is represented as R S where S is an integer in {90,180,270...} which denotes the number of degrees to rotate .You need to rotate the matrix A by angle S in the clockwise direction.

The angle of rotation S will always be in multiples of 90 degrees.

Update: It is represented as U X Y Z. In initial matrix A , you need to update the element at row index X and column index Y with value Z.

Querying: It is represented as Q K L.You need to print the value at row index K and column index L of the matrix of the matrix A.


Sample Input 1

2

1 2

R 90

Q 0 0

Q 0 1

R 90

Q 0 0

U 0 0 6

Q 1 1

-1


Sample Output 1

3

1

4

6


Sample Input 2

2

5 6

7 8

R 90

Q 0 1

R 270

Q 1 1

R 180

U 0 0 4

Q 0 0

-1

Sample Output 2

5

8

8



The first line will contain a message prompt to input the text message.

The second line will contain the number of vowels found in the text message.






Smallest of the Three

by CodeChum Admin

There's always going to be that odd one out. In this case, it's the one with the smallest value. It's your job to determine which one that is!


Instructions:

  1. Input three integers in one line.
  2. Evaluate the integers using conditional statements and print out the integer with the smallest value among the three.

Input

A line containing three integers separated by a space.

10·5·-5

Output

A line containing an integer.

-5
LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS