hisoka Posted April 27, 2015 Posted April 27, 2015 (edited) languages = ["german" , "english" , "italian"] for x in languages: print(x) , len(x) it gives me : german (none , 6) english (none , 7) italian (none , 7) but I want it to be german 6 english 7 italian 7 how ? Edited April 27, 2015 by hisoka
justsomeguy Posted April 27, 2015 Posted April 27, 2015 I don't think that the len is part of the print statement because of the parentheses. You can also format the output exactly how you want.https://docs.python.org/2/tutorial/inputoutput.html
hisoka Posted April 30, 2015 Author Posted April 30, 2015 I found it . It becomes like this : languages = ["german" , "english" , "italian"] for x in languages: print(x , len(x))
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now