PYTHON EXERCISE 1
Problem Statement:
So, in this tutorial, i.e., Python exercise 1 tutorial, we have to create a dictionary similar to the real-world dictionary. There is no limit to the definition you provide to any word, as this exercise is just for your practice.
The details and functionalities that are essential and must be present are:
- The user will give the word as input. Suppose that the word is present in your dictionary along with its definition or meaning.
- The program will print the meaning or definition of that word.
For example:
The user inputs the word: “programming”
The output will be:
"the process of writing computer programs"
Your primary focus should be towards writing a neat and efficient code, using only the knowledge from our previously done tutorials.
I would encourage all of you to participate in solving this task. At least give it a try so you may have an idea about your progress because the starting tutorials make the real basis for the upcoming one’s and if the basics aren’t strong, we can not achieve our desired goal of becoming a better python language programmer.
SOLUTION:
#create a dictionary and take a input from user and return the meaning of the word from the dictionary
print ("welcome the dictionary")
d1 = {"air":"combination of different gasea", "optimistic":"beleive in god", "charming":"looking pleasent"}
word = input("enter your word for meaning" )
print (d1, "means", d1[word])
Comments
Post a Comment