Question

Write a program which accepts a sequence of commaseparated numbers from console and generate a list and a tuple which contains every number.

Suppose the following input is supplied to the program:
23,45,67,78,89
Then, the output should be:
['23', '45', '67', '78', '89']
('23', '45', '67', '78', '89')

Answer

Get the step-by-step solution for this question inside the Vidyadip app.

Get the answer in the app

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

Write a program that reads a line and a substring. It should then display the number of the occurrence of the given substring in the line.

Answer the following question the basis of given dataframe:

Itemno ItemName Color Price
0 1 Ball Pen Black 15.0
1 2 Pencil Blue 5.5
2 3 Ball Pen Green 10.5
3 4 Gel Pen Green 11.0
4 5 Notenook Red 15.5
5 6 Ball Pen Green 11.5
6 7 Highlighter Blue 8.5
7 8 Gel Pen Red 12.5
8 9 P Marker Blue 5.6
9 10 Ball Pen Green 11.5

(i) To set the index to column Item Name.

(ii) To print the pivoting the data based on Item name as index, column as color and values as price.

(iii) To print the data as row index Itemname and columns index as color. Fill NaN as blank

(iv) To create another alias df3 and store the result of question 2.

(v) To add a new column QTY.

(vi) To print the mean priceod of all Item name and color wise.

(vii) To print the mean of the price, Item name and color margin wise.

(viii) To print the mean of the price, Item name and color wise with margins as Total.

(ix) To display the sorted data in ascending order according to the price

(x) To display the sorted data in descending order according to the price

(xi) To sort the data index wise.

(xii) To print the median.

(xiii) To print the maximum values column wise.

(xiv) To print the sum of the price.

(xv) To print the maximum of each column

(xvi) To print the first quantile of the price.

(xvii) To print the first quantile of Item no

(xviii) To print the first quartile, second quartile and third quartile. of Item no.

(xix) To print all the descriptive statistics.

Write a function to read the content from the file “India.txt”, and store the frequency of each character in dictionary and display the dictionary in the screen. Content of the file is: ‘‘India is the fastest growing economy. India is looking for more investments around the globe. The whole world is looking at India as a great market. Most of the Indians can foresee the heights that India is capable of reaching.’’ Output is: {'I': 5, 'n': 15, 'd': 7, 'i': 15, 'a': 17, ' ': 39, 's': 13, 't': 15, 'h': 10, 'e': 20, 'f': 5, 'g': 8, 'r': 9, 'o': 17, 'w': 3, 'c': 4, 'm': 4, 'y': 1, '.': 4, 'n': 4, 'l': 6, 'k': 3, 'v': 1, 'u': 1, 'b': 2, 'T': 1, 'M': 1, 'p': 1}
Answer the following questions based on dataset given below:

TNO Tname Tadd Salary
0 T01 Amit 123 Paschim Vihar 23000
1 T02 Rajesh 6/11 Ramesh Nagar 34000
2 T03 Binny 5 West Punjabhi Bagh 12000
3 T04 Charu 23Malviya Nagar 45000
4 T05 Meenakshi 19 Meera Bagh 34000

(i) To write the statement to import the required library.

(ii) To create the data frame from the above dictionary.

(iii) To print the data frame.

(iv) To print the name columns.

(v) To print the complete information of the data frame.

(vi) To print the index of data frame.

(vii) To print the various attributes of the data frame i.e Shape, Dimensions, Columns and number of records.

(viii) To print the records whose salary is greater than 5000.

(ix) To create another data frame which will store all the records of the teacher whose salary is greater than 5000.

(x) To display the Salary.

(xi) To set the index to the column 'Tname'.

(xii) To display the record of 'Amit'.

(xiii) To display the record fo 'Amit' and 'Binny'

(xiv) To display the Salary and Address of 'Amit' and 'Binny'.

(xv) To display the records of the teachers whos are earning salary more than 10000.

(xvi) To display the records of the teachers whos are earning salary less than 40000.

(xvii) To add new column Dearness Allowance with any values.

(xviii) To add new column "HRA" using .loc().

(xix) To add new column tax using assign().

(xx) To display the HRA column.

(xxi) To display the records of the Teachers who have HRA of more than 500.

(xxii) To add a new column Total Salary which is to be calculated as Salary + HRA - Tax.

(xxiii) To fill all NaN values with 5000.

(xxiv) To replace all the NaN with space.

(xxv) To Update the new colum with values as Salary + HRA + Dearness Allowance - Tax

Write the output of the given commands:

Based on the given dataset answer the questions given below:

From_To FlightNumber RecentDelays Airline
0 NewDelhi_Chennai 10045.0 [23, 47] Spicejet
1 Mumbai_NewDelhi NaN [] Indigo
2 Jaipur_Jammu 10065.0 [24, 43, 87] Spicejet
3 Chennai_Lucknow NaN [13] Indian Airlines
4 Mumnbai_Chennai 10085.0 [67, 32] Spicejet

(i) #To display the maximum flight number

(ii) #To print the number of flights airline wise

(iii) #to drop the nan values from the dataframe

(iv) To fill nan with blank values

(v) To print the maximum values of recent delays

(vi) To print the median of all the numeric values.

(vii) To print the sum of the recentdelays

(viii) To count the flight numbers.

(ix) To print the airline wise the sum of the recentdelays along with From_to as column

(x) To print the airline wise the sum of the recentdelays along with From_to as column. Also fill NaN values as blank.

Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.
Suppose the following input is supplied to the program:
We are on first line.
second line
third line in python.
Then, the output should be:
WE ARE ON FIRST LINE.
SECOND LINE
THIRD LINE IN PYTHON.
Write a function to read the content from the file “India.txt”, and store the frequency of each word in dictionary and display the dictionary in the screen. Content of the file is: ‘‘India is the fastest growing economy. India is looking for more investments around the globe. The whole world is looking at India as a great market. Most of the Indians can foresee the heights that India is capable of reaching.’’ Output of the file: {‘India’: 4, ‘is’: 4, ‘the’: 4, ‘fastest’: 1, ‘growing’: 1, ‘economy.’: 1, ‘looking’: 2, ‘for’: 1, ‘more’: 1, ‘investments’: 1, ‘around’: 1, ‘globe.’: 1, ‘The’: 1, ‘whole’: 1, ‘world’: 1, ‘at’: 1, ‘as’: 1, ‘a’: 1, ‘great’: 1, ‘market.’: 1, ‘Most’: 1, ‘of’: 2, ‘Indians’: 1, ‘can’: 1, ‘foresee’: 1, ‘heights’: 1, ‘that’: 1, ‘capable’: 1, ‘reaching.’: 1}
p>Suppose we want to sort the following list of 7 elements in ascending order using insertion sort

Write the complete steps to sort the above along with each pass explanation.

Write the Pseudocode to sort the list using Bubble sort– to sort a list A in ascending order

Write a program to create the list and ask user whether you want to delete an element if say yes then delete the element and print the new list else print the entered list.