Skip to content

ujwal6-eng/Data-Structures-and-Strings-in-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Data-Structures-and-Strings-in-Python

Assignment 5

Task 1: Create a Dictionary of Student Marks

Problem Statement: Write a Python program that:

  1. Creates a dictionary where student names are keys and their marks are values.
  2. Asks the user to input a student's name.
  3. Retrieves and displays the corresponding marks.
  4. If the student’s name is not found, display an appropriate message.

Expected Output: Enter the number's name: Alice Alice's marks: 85

If the student does not exist in the dictionary:

Enter the student's name: John Student not found.

Task 2: Demonstrate List Slicing

Problem Statement: Write a Python program that:

  1. Creates a list of numbers from 1 to 10.
  2. Extracts the first five elements from the list.
  3. Reverses these extracted elements.
  4. Prints both the extracted list and the reversed list

Expected Output: Original list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Extracted first numbers: [ 1, 2, 3, 4, 5 ] Reverse extracted elements: [5, 4, 3, 2, 1]

About

Assignment 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages