0% found this document useful (0 votes)
72 views

Lab Task 12 Random

This document describes 3 coding exercises: 1. Create a list of Pakistani cities, shuffle it randomly, and print the shuffled list 2. Define a list of student names, pop one name, transfer the remaining names to a new list, and use random sampling to select 2 students from the new list for a scholarship 3. Define two lists representing dice with numbers 1-6, write a program to simulate two players rolling the dice and determine a winner

Uploaded by

ayaan khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Lab Task 12 Random

This document describes 3 coding exercises: 1. Create a list of Pakistani cities, shuffle it randomly, and print the shuffled list 2. Define a list of student names, pop one name, transfer the remaining names to a new list, and use random sampling to select 2 students from the new list for a scholarship 3. Define two lists representing dice with numbers 1-6, write a program to simulate two players rolling the dice and determine a winner

Uploaded by

ayaan khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Experiment No.

12
Lab 12 – Introduction
Exercise:
Q.1 Create a list of different Cities of Pakistan and by using random module Shuffle that list.

CODE:

OUTPUT:

Q.2 Define a list, consisting of names of different students, who are applying for a scholarship,
pop an item from that list and transfer all items in a new list and apply sample method of
random module to give scholarship to two students of new list.

CODE:

OUTPUT:
Q.3 Define two lists dice1 and dice2, holding numbers from 1 to 6 ,Design a python program
that start playing with two dices for two players

CODE:

OUTPUT:

You might also like