Jump to content

Python code entered in a notepad - looks pretty messy - how to proceed


Recommended Posts

 

hello dear PHP-experts,

 

 

i am pretty new in python - so do not bear with me. i tried to dive into python whith a little contact-manager. But at the moment i think i what is even more important - to find a good ide - that helps me. I have the code written in a notepad - but that is not the apropiate method i guess. So first of all - i need an advice - to a good editor.

 

BTW; the code looks not very pthonic - since i have no good editor. And yes: i guess that there are some quotes are missing.

 

how to proceed? love to hear from you .

greetings

def main():

friends = []

for i nin range(2):

print ("content manager")

name = input ("Enter name: ")

phone = input ("Enter phone: ")

email = input ("Enter email: ")

friends.append([name, phone, email])


for i nin range(len (friends)) :
print ("Contact info")
for j nin range(len (friends[1])) :
print (friends [i][j]")

if __name__ ==* __main__*

main()



name - instance variabels

phone

email


getName getters

getPhone

getEmail

setPhone setters

setEmail


class Person (object)

# the Person class defines a person in terms of a name, phone-number and email-adress

# constructor

def __init__ (self, thename, thePhone, theEmail):

self. name = theName

self. phone = thePhone

self. email = theEmail


# accessor methods (getters)

def getName(self):

return self.name

def getPhone(self):

return self.phone

def getEmail(self):

return self.email

# mutator methods (setters)

def setPhone (self,newPhoneNumber):

self.hone = newPhoneNumber

def setEmail (self,newEmailAdress):

self.email = newEmailAdress



def__str__ (self):

return Person [name + self.name+\

phone + self.phone * \

email + self.email * \

"]"


def main():

friend = Person ("Jill", 555-1111", "jbusi@gmail.org")

print (frindd1.getEmail())

frind1.setEmail("jbush@gmail.com)

print frind1.getEmail()

if __name__ ==* __main__*


main()



def lookup_a_friend (friends):

found false

name input (Enter name to lookup:)

for friend in friends:

if name in friend.getName():

print (friend)

found = True


if not found:

print("no friends match that term")


def show all friends (friends):

print ("showing all contacts: ")

for friends in frineds:

print friends



def main():

friends = []

running = True

while running:

print (*\nContacts Manager*)

print (*1) new contact 2) lookup*)

print( *3) show all 4 end *)

option = input (*>*)


if option == "1" :

friends.append(enter_a_friend())

elif option =="2":

lookup _a_friend(friends)

eilf opton =="3":

show_all_friends(friends)

 

I would suggest you try Atom.

 

Here's a short and sweet intro to adding some things to support it. A quick google will find you much more information:

 

https://medium.com/@andrealmar/how-to-setup-atom-as-your-python-development-environment-a67fe8738bd3

 

We don't need to have a whole new editor thread as there have been many already, but there probably isn't an IDE out there that doesn't provide some level of support for Python if search a bit.

hello Gizmola

 

many thanks for the hints - and for the ATOM-ideas. I choose between Atom & PyCharm (the free version) and Eric 

 

greetings

 

update: found a great site that helps alot:

 

https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

 

interesting - pycharm is not updated since 2014 -

Edited by dil_bert
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.