Posts

Showing posts from December, 2020

Which programming language should you start with?

Image
It’s a very common question among students of varying background, from school goers to aspiring computer engineers. Where to start? Which language they should learn first? Which language is easiest and can be used for variety of applications? I will try to answer these questions in this blog with the help of some examples. When compared with other programming languages Python is easiest. Python reads like English and is simple to understand for someone who's new to programming. Now with the help of simple programs I am going to show why Python is easier than other programming language. Suppose you want to print 'Namaste'. How it can be done in Java, C and Python: 'Namaste' in Java class Namaste { public static void main ( String [] args ) { System . out . print ( "Namaste!" ) ; } } Go to the location where you saved the file. Compile the code with javac.   Then run the code with java.   Just to print a 'Namaste' you are required to ...

How to Create Telephone Directory in Python

Image
Telephone Directory is a Python application that keeps names and email addresses in a dictionary as key-value pairs. The program should display a menu that lets the user look up a person's email address, add a new name and email address, change an existing email address, and delete an existing name and email address. The program should pickle the dictionary and save it to a file when the user exits the program. Each time the program starts, it should retrieve the dictionary from the file and unpickle it. import pickle try : contact = pickle . load ( open ( "save.p" , "rb+" ) ) except IOError : contact = { } pass def pick ( ) : pickle . dump ( contact , open ( "save.p" , "wb" ) ) def store ( ) : global contact name = input ( "Enter name:" ) phone = input ( "Enter Phone:" ) if name in contact : print ( "Contact Already exists !\n" ) else :               Continue Reading... Learn Py...