Path: blob/master/Data Analytics Using Python/Lab1 Python Basics.ipynb
3074 views
Kernel: Python 3 (ipykernel)
Question 1: Student Grade Calculator
Write a Python script that:
Takes student names and their marks (out of 100) as input from the user in a loop (until the user types "stop").
Stores this information in a dictionary where the key is the student name and the value is the marks.
After input is complete, iterate through the dictionary and:
Print each student's name with their grade based on the following rules:
In [1]:
Out[1]:
Enter student name (or 'stop' to finish): Ojes
Enter marks for Ojes: 90
Enter student name (or 'stop' to finish): Ashi
Enter marks for Ashi: 100
Enter student name (or 'stop' to finish): 50
Enter marks for 50: 50
Enter student name (or 'stop' to finish): stop
Grades:
Ojes: A
Ashi: A
50: C
Question 2: Word Frequency Counter
Write a Python script that:
Takes a sentence as input from the user.
Splits the sentence into words and counts the frequency of each word using a dictionary.
Print the frequency of each word, and also:
If a word appears more than 3 times, print "High Frequency" next to it.
Otherwise, print "Normal Frequency"
In [3]:
Out[3]:
Enter a sentence: happy happy sad sad
Word Frequencies:
happy: 2 -> Normal Frequency
sad: 2 -> Normal Frequency
In [ ]: