Click here to Skip to main content
15,888,088 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
-7


Can someone help me ("John, 9,20,70,92")how to become ['John, '9','20','70','92'] John has passed the course! Assignment1:9/10
Assignment2:20/30
 Quizzes:7.0/10 
Exam:92 
Finalmark:93.75%
 how to calculate this


What I have tried:

can someone help me solve this
def marks(x):
  data = x.split(',')
  name = data[0]
  a1 = float(data[1])
  a2 = float(data[2])
  q =float(data[3])
  e = float(data[4])
  fr = a1+a2+q+(e/100*50)
  data = ''
    for f in fr:
      if not fr in '51-100':
        data
Posted
Updated 25-May-19 18:42pm
v4
Comments
Richard Deeming 24-May-19 15:30pm    
Your username makes it look like you're about to start posting "live-stream sports" spam. If you're not, then I would recommend changing it to something else.
jo1738313 25-May-19 1:30am    
no I'm not
Richard MacCutchan 25-May-19 3:47am    
Then change your username before some trigger happy people decide to kill your account.
jo1738313 26-May-19 0:42am    
can u help me iupdate y'what I had tried' can u plz help me becoz this is task work can u help me plzzzzzzzz

You need to specifiy the separator character to split the string:
Python
data = x.split(',')  # split into fields
print(data) # print the new list

The variable data is now a list of the individual fields, so you can process then as required. But do not print the entire (expected) results in one statement as you have done. Process and print each field separately.
 
Share this answer
 
Comments
jo1738313 25-May-19 8:59am    
may I ask how to calculate the final result
can u see 'what I tried' whether I'm on a right track or not becoz using split and for loop still cannot
Richard MacCutchan 25-May-19 10:03am    
You calculate the answers based on the rules of the question. But you have not told us what those rules are.
jo1738313 25-May-19 21:48pm    
assignment 1 is worth 10%, assignment 2 is worth 30%, the quizzes are worth 10%, and the
exam is worth 50%.

Richard MacCutchan 26-May-19 3:24am    
That is just simple mathematics.
jo1738313 26-May-19 0:43am    
can u plz help me Richard becoz this is my task work and I have updated y'what I had tried 'can u plzz help me take a look
Just print the "name", for starters. When that works, try something else.

Your current "print" looks confused.
 
Share this answer
 
Comments
jo1738313 25-May-19 1:33am    
a little bit confuse can have some example
jo1738313 26-May-19 0:44am    
can u help me plzzzzzz

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900