I have many single float but how I can make then to be list of float?
thanadaray
0
Newbie Poster
Recommended Answers
Jump to PostIf you have like this:
a = 2.2 b = 1.4 c = 2.7 d = 3.5 e = 42.8
one easy way is to simple create the list:
l=[a, b, c, d, e] print l '''output: [2.2, 1.4, 2.7, 3.5, 42.8]'''
Jump to PostI have many single float but how I can make then to be list of float?
It's fairly easy. At the top of your program, you add
thelist = list()
. Then when you want to add a score to the list, you writethelist.append(score)
. Finally, addprint(thelist)
at …
All 7 Replies
Lucaci Andrew
140
Za s|n
thanadaray
0
Newbie Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
Lucaci Andrew
140
Za s|n
Lucaci Andrew
140
Za s|n
Gribouillis
1,391
Programming Explorer
Team Colleague
vegaseat
commented:
should solve it
+14
HiHe
commented:
helpful
+4
HiHe
174
Junior 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.