Question
Write a python program using function to demonstrate random() along with list, tuple and dictionary. The program should do 3 things: (i) Should create the list of 5 random numbers between 10 to 99. (ii) Should create the tuple of 5 random numbers between 10 to 99. (iii) Should create the dictionary of 5 keys:values random characters as key and ASCII as its value.

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 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')

Write a python program to plot the grouped bar chart for the given data:

The program is to be implemented to sub plot

WAP to find the sum of first n terms of the following series:
$1+ x +\frac{x^2}{2}+\frac{x^3}{3}+\ldots$
Granuda Consultants are setting up a secured network for their office campus at Faridabad for their day to day office and web based activities. They are planning to have connectivity between 3 buildings and the head office situated in Kolkata. Answer the questions (a) to (d) after going through the building positions in the campus and other details, which are given below:

Distances between various buildings:

Building “RAVI” to Building “JAMUNA” 120m
Building “RAVI” to Building “GANGA” 50m
Building “GANGA” to Building “JAMUNA” 65m
Faridabad Campus to Head Office 1460km

Number of computers:

Building “RAVI” 25
Building “JAMUNA” 150
Building “GANGA” 51
Head Office 10

(a) Suggest the most suitable place (i.e. block) to house the server of this organization. Also give a reason to justify your suggested location.

(b) Suggest a cable layout of connections between the buildings inside the campus.

(c) Suggest the placement of the following devices with justification:

(i) Switch

(ii) Repeater

(d) The organization is planning to provide a high speed link with its head office situated in KOLKATA using a wired connection. Which of the following cable will be most suitable for this job?

(i) Optical Fiber

(ii) Co-axial cable

(iii) Ethernet cable

Write Push(Book) and Pop(Book) methods in Python to Add a new Book and Remove a Book from a List of Books, considering them to act as PUSH and POP
operations of the data structure Stack.
Consider the following table HOSPITAL.

Table: HOSPITAL

PNo Name Age Department DateofAdm Charges Sex
1 Mayank 65 Surgery 23/02/2018 600 M
2 Babita 24 ENT 01/01/2019 400 F
3 Kashish 45 Orthopaedic 19/12/2018 400 M
4 Tarun 12 Surgery 01/10/2018 600 M
5 Manisha 36 ENT 12/01/2018 400 F
6 Imran 16 ENT 24/02/2018 400 M
7 Ankita NULL Cardiology 20/08/2018 800 F
8 Zoya 45 Gynecology 22/02/2018 500 F
9 Kush 19 Cardiology 13/01/2019 800 M
10 Shalini 31 Medicine 19/02/2018 300 F

Note: PNo is the primary key in the above table.

Write SQL commands for the statements (a) to (g) on the table HOSPITAL.

(a) To display the details of all the patients whose name starts with the alphabet ‘Z’.

(b) To change the age of the patient Kush to 20.

(c) To increase the charges of all the patients by 5%.

(d) To remove the record of the patient whose Name is Tarun.

(e) To add another column DocName(Doctor Name) of the type varchar in the above table.

(f) To display patient detail whose age is missing(null).

(g) To decrease the charges by 5% of all the patients admitted to the ENT department.

How to Delete Indices, Rows or Columns From a Pandas Data Frame?
Write a program to create the list and ask user whether you want to add new element if say yes then add the element and print the new list else print the entered list.
Write the function Change(), to double the even elements and triple the odd elements present in a list. The function will take and list as parameter and also return the list.

Consider the following tables CARHUB and CUSTOMER and answer (a) and (b) parts of this question:

Table: CARHUB

Vcode VehicleName Make Color Capacity Charges
100 Innova Toyota WHITE 7 15
102 SX4 Suzuki BLUE 4 14
104 C Class Mercedes RED 4 35
105 A-Star Suzuki WHITE 3 14
108 Indigo Tata SILVER 3 12

Table: CUSTOMER

CCode CName VCode
1 Hemant Sahu 101
2 Raj Lal 108
3 Feroza Shah 105
4 Ketan Dhal 104

(a) Write SQL commands for the following statements:

(i) To display the names of all white colored vehicles

(ii) To display name of vehicle, make and capacity of vehicles in ascending order of their sitting capacity

(iii) To display the highest charges at which a vehicle can be hired from CARHUB.

(iv) To display the customer name and the corresponding name of the vehicle hired by them.

(b) Give the output of the following SQL queries:

(i) Select count(distinct make) from cabhub;

(ii) Select max(charges), min(charges) from carhub;

(iii) Select count(*), make from carhub;

(Iv) Select vehiclename from carhub where capacity = 4;