I want to write a function for f(y) = xy^2 in Python. Like if I pass value such as f(3) then it should give output as 9x. How to do it? Aug 5 in Python 24 views

## 1 answer to this question.

This is very easy. have a look at the following code -

```>>> def f(y):
return str(y**2) + 'x'
>>> f(9)

'81x'```

And if you have the value of constant then

```def f(y):
x=2
return x*(y**2)
>>> f(2)
8
>>> ```

Suppose you have a polynomial equation such as

p(x)=x4−4⋅x2+3⋅xp(x)=x4−4⋅x2+3⋅x then in this case :

```>>> def p(x):
return x**4 - 4*x**2 + 3*x
>>> p(2)
6

``` answered Aug 5 by
• 3,010 points

edited Aug 6 by Kalgi

## how to print array integer without [] bracket in python like result = 1,2,3,4,5

Hey @abhijmr.143, you can print array integers ...READ MORE

## How to create and read from a temporary file in Python?

Hi, there is a very simple solution ...READ MORE

## How to create a GUID/UUID in Python

The uuid module, in Python 2.5 and ...READ MORE

## how to sort a list of numbers without using built-in functions like min, max or any other function?

Yes it is possible. You can refer ...READ MORE

+1 vote

## how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

## how do i use the enumerate function inside a list?

can you give an example using a ...READ MORE

## Lowercase in Python

You can simply the built-in function in ...READ MORE