Console.WriteLine("求解方程ax^2+bx+c=0的解."); Console.WriteLine("请分别输入a,b,c的值(注意每输入一个值按一下回车):"); double a = double.Parse(Console.ReadLine()); double b = double.Parse(Console.ReadLine()); double c = double.Parse(Console.ReadLine()); * a * c;
#!/usr/bin/python # 导入math包 import math def quadratic(a, b, c): if not isinstance(a, (int, float))and isinstance(a, (int, float)) and isinstance(a, (int, float)): raise TypeError('a or b or c must be a number') dt = int(b) ** 2-(4*int(a)*int(c)) if a
如下是<Python Text Processing with NLTK 2.0 Cookbook>一书部分章节的代码笔记. Tokenizing text into sentences >>> para = "Hello World. It's good to see you. Thanks for buying this book." >>> from nltk.tokenize import sent_tokenize >&g