def square_route(): num = request.args.get('num') if num is None or not num.isdigit(): return render_template('usage.html', error=True) res = square(num) return render_template('result.html', name="Square", num=num, res=res)
def squarePoint(self): print(square(self.x))
from functions import square #function square is read from the functin.py print(square(2))
from functions import square print(square(5)) # BUT HERE, THIS PRINTS THE FOR LOOP FROM FUNCTIONS FILE AND THE 25. WE NEED JUST THE 25. # IT'S NECESSARY TO ENCAPSULATE THE LOOP IN A FUNCTION
from functions import square for i in range(10): print("The square of " ,i ,"is", square(i)) #or import functions for i in range(10): print("The square of " ,i ,"is", functions.square(i))
import functions print(functions.square(10))
def test_invalid_input(self): with self.assertRaises(TypeError): functions.square('a')
from functions import square for i in range(1000): print("{} square is {}".format(i, square(i)))
from functions import square for i in range(10): print("The value of i is ", square(i))
from functions import square print(square(16)) for i in range(10): print(f"The square of {i} is {square(i)}")
def test_square(self): for i, item in enumerate(square_test_data): with self.subTest(text="sequence: " + item): self.assertEqual(square(item), square_test_result[i])
from functions import square print(square(1))
from functions import square a = int(input("Enter the input number : ")) print(square(a))
from functions import square print(square(12))
def check_square(self, x, y_desired): y_actual = functions.square(x) np.testing.assert_equal(y_desired, y_actual)
def test_square(): assert square(8) == 64
def main(): for i in range(10): print("{} squared is {}".format(i, square(i)))
from functions import square for i in range(10): print(square(i))
from functions import square print("Calling functions:") print("Square of 10:", square(10)) from function1 import square print("Calling function1:") print("Square of 10:", square(10))
def main(): #main function for i in range(10): print("{} squared is {}".format(i, square(i)))
import functions base = int(input("x: ")) top = int(input("y: ")) print(f"{base}^{top} = ", functions.square(base, top)) for i in range(11): print(f"The square of {i} is {functions.getSquare(i)}")
from functions import square print(square(10))
from functions import square print(square(10))#u can use fuctions created before anywhere,even not yours!