ElaKiri Community
Downloads
(#1)
Old
Absolute Zero's Avatar
Absolute Zero Absolute Zero is offline
Senior Member
Absolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to behold
 
Posts: 7,477
Join Date: Mar 2015
Location: −273.15°C
! Array Help! - 10-31-2019, 08:40 AM

මෙන්න මේක කොහොමද කරන්නේ පයිතන් වලින්...

? store subject marks of 10 students in to an array and output number of students who have more than average mark of a subject.


from array import *

arr = array('i',[])

n = int (input("Enter the length of the array : "))

for i in range(n):
x = int(input("Enter marks : "))
arr.append(x)
Reply With Quote
(#2)
Old
kolavari's Avatar
kolavari kolavari is offline
Senior Member
kolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to behold
 
Posts: 21,410
Join Date: Aug 2012
Location: කැළෑ පොජ්ජේ
10-31-2019, 09:27 AM

Use list operations..map etc..
Reply With Quote
(#3)
Old
Absolute Zero's Avatar
Absolute Zero Absolute Zero is offline
Senior Member
Absolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to beholdAbsolute Zero is a splendid one to behold
 
Posts: 7,477
Join Date: Mar 2015
Location: −273.15°C
10-31-2019, 09:32 AM

Quote:
Originally Posted by kolavari View Post
Use list operations..map etc..
Code eka dahanko puluwan nm...
Reply With Quote
(#4)
Old
kolavari's Avatar
kolavari kolavari is offline
Senior Member
kolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to beholdkolavari is a splendid one to behold
 
Posts: 21,410
Join Date: Aug 2012
Location: කැළෑ පොජ්ජේ
10-31-2019, 09:37 AM

marks = [ 100, 30, 40 ]
mean = sum(marks) / len(marks)
print len(list(filter(lambda i: i > mean, marks))

Last edited by kolavari; 10-31-2019 at 10:15 AM.
Reply With Quote
(#5)
Old
SagaxConatusV's Avatar
SagaxConatusV SagaxConatusV is offline
Senior Member
SagaxConatusV is a jewel in the roughSagaxConatusV is a jewel in the roughSagaxConatusV is a jewel in the roughSagaxConatusV is a jewel in the roughSagaxConatusV is a jewel in the roughSagaxConatusV is a jewel in the rough
 
Posts: 1,307
Join Date: Oct 2014
Location: Gedara
10-31-2019, 11:49 AM

loop dekakin nuth karanna puluwn kolaweri dala tiyenwa wage lassanta enne ne habai

isselama array ekakata marks tika gannawa uba karala tiyenwa wage. itapasse for loop ekakin sum eka gannawa.
array length eken sum eka bedanawa. meke result eka tamai average eka.
(divide by zero walata check ekak danna one)

itapasse ayeth marks array eka loop karala hama element ekak ma average ekata wada wadida kiyala balanwa. wadi nam aluth array ekakata danawa.

itapasse aluth array eke length eka print karanwa.
Reply With Quote
(#6)
Old
HKavinda's Avatar
HKavinda HKavinda is online now
Senior Member
HKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond reputeHKavinda has a reputation beyond repute
 
Posts: 44,642
Join Date: Dec 2013
Location: 🅸🅽🆃🅴🆁🅽🅴🆃
10-31-2019, 11:59 AM

බම්පි
Reply With Quote
(#7)
Old
ThisaraMalintha's Avatar
ThisaraMalintha ThisaraMalintha is offline
Senior Member
ThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to beholdThisaraMalintha is a splendid one to behold
 
Posts: 6,770
Join Date: Nov 2015
Location: ගෙදර
10-31-2019, 12:12 PM

bump
Reply With Quote
(#8)
Old
kinkon's Avatar
kinkon kinkon is offline
Senior Member
kinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond reputekinkon has a reputation beyond repute
 
Posts: 50,117
Join Date: Aug 2007
Location: Kandy ♕
10-31-2019, 09:35 PM

Bump
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright © 2006 - 2011 ElaKiri™ Beta2.Evo vBulletin, vBa iBproArcade Subdreamer I-Magic MKv

Page generated in 0.01785 seconds with 11 queries