Jump to content

what does this python code do - and why do we have a list in a list here


Recommended Posts

hello dear experts

 

what does this python code do - and why do we have a list in a list here

def main ():

friends []

for  i in range(2)

print ("contact manager")
name = input("input name")
phone = input("input phone")
name = input("input email")

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


for in in range(len(friends)):
print ("contact info")
for j in rang(len(friends[1])):
print(friends[i][j])

if __name__  == *__main__*:
main()

hello dear requinix

 

it is true - python is very readable

 

Python is a very readable language. Take a guess at what it's doing.

 

 

in short:

 

this code waits for an entry -

 

of contact-info

and takes then the gathered data and prints it out.

 

the first list takes care for gathering the infos - from "user-entry"

the second list ( let me say it wraps all the things)  prints out the gathered infos

 

 

this is only a very very short form of what i read out of the code...

 

note: i have to use a better IDE or Editor... To use such is pretty important in Python -. because oft he indentation...

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.