我可以问一下jes jython问题 [英] May I ask about 1 jes jython question

查看:221
本文介绍了我可以问一下jes jython问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

-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

推荐答案

您需要指定分隔符来分割字符串:

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



变量 data 现在是各个字段的列表,因此您可以根据需要进行处理。但是不要像你所做的那样在一个语句中打印整个(预期的)结果。分别处理和打印每个字段。


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.


为初学者打印名称。如果有效,请尝试别的。



您当前的打印看起来很混乱。
Just print the "name", for starters. When that works, try something else.

Your current "print" looks confused.


这篇关于我可以问一下jes jython问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆