Suppose i have a list l=[1,2,3]
i want to make this list as [2,3,4] i.e. add 1 to all the values in list l.
I want to do it by the method of for loop.. Can someone help?
utkarshsahu
0
Newbie Poster
Recommended Answers
Jump to PostOkay, I haven't been on in a while, let me tell you why no one has replied, you haven't showed ANY effort. Let me see the code you have so far and I'll tell you what you're doing wrong and give you suggestions. This is a simple solution, and you …
Jump to PostYou must initialize the newlist out of the loop otherwise you reset before you add next one and you are left with the last value in the list.
All 6 Replies
JoshuaBurleson
23
Posting Whiz
utkarshsahu
0
Newbie Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
utkarshsahu
0
Newbie Poster
utkarshsahu
0
Newbie Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.