fork download
  1. course="Python Programming"
  2. score=95.5
  3. #使用f-string拼接(注意原句没有空格在课程和成绩之间)
  4. sentence=f"{course}课程的成绩是{score}分"
  5. print(sentence)
  6. #输出score的数据类型print(type(score)
  7. course_under=course.replace(" ","_")
  8. print(course_under)
  9. count_o=course.count('o')
  10. print("字母o出现的次数:",count_o)
Success #stdin #stdout 0.07s 7984KB
stdin
Standard input is empty
stdout
Python Programming课程的成绩是95.5分
Python_Programming
字母o出现的次数: 2