我正在使用HTML + CSS + AngularJS制作一个简单的计算器。一切都很好,但我想添加一个SquareRoot功能。 这是一些代码:
function _solve(){
switch(_state) {
case 'ADD':
_total += parseFloat($scope.console);
$scope.console = 0;
break; //similar for the rest of the operations
$scope.add = function() {
_solve();
_state = 'ADD';} //this is how i call the function.
这是我对Sqrt的想法,但我认为不好:
$scope.getSqrt = function() {
$scope.console = (parseFloat($scope.console) * Math.Sqrt).toString();}
答案 0 :(得分:0)
Math.sqrt是一个函数,这意味着您需要将要应用函数的数字放在括号内,如此
NM_CUSTOMDRAW
答案 1 :(得分:0)
您需要将您希望从平方根中提取的数字作为参数提供给__author__ = 'Janis'
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import tweepy
impot time
# Initialize tweepy functions------------------------------------------------
CONSUMER_KEY =''
CONSUMER_SECRET = ''
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
class Listener(tweepy.StreamListener):
def on_status(self, status):
print status.text
return True
def on_error(self, status_code):
print 'Error in streaming'
print status_code
pass
keyword = 'ISIL'
twitterStream =tweepy.Stream(auth=auth, listener=Listener())
twitterStream.filter(track=[u'الإسلامية'])
函数,例如:
Math.sqrt()