dil_bert Posted January 12, 2018 Share Posted January 12, 2018 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() Quote Link to comment https://forums.phpfreaks.com/topic/306159-what-does-this-python-code-do-and-why-do-we-have-a-list-in-a-list-here/ Share on other sites More sharing options...
requinix Posted January 13, 2018 Share Posted January 13, 2018 Python is a very readable language. Take a guess at what it's doing. 1 Quote Link to comment https://forums.phpfreaks.com/topic/306159-what-does-this-python-code-do-and-why-do-we-have-a-list-in-a-list-here/#findComment-1555283 Share on other sites More sharing options...
dil_bert Posted January 13, 2018 Author Share Posted January 13, 2018 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... Quote Link to comment https://forums.phpfreaks.com/topic/306159-what-does-this-python-code-do-and-why-do-we-have-a-list-in-a-list-here/#findComment-1555297 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.