QUESTION IMAGE
Question
compute: $\boldsymbol{\text{val} = w^{|x|}}$
click here for example
1 import math
2
3 w = float(input())
4 x = float(input())
5
6 \\\ your code goes here \\\
7
8 print(f\val = {val:.2f}\) # outputs val with 2 decimal places
Step1: Calculate absolute value of x
$|x| = \text{math.fabs}(x)$
Step2: Compute val as w times |x|
$\text{val} = w \times |x|$
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
import math
w = float(input())
x = float(input())
# Your code goes here
val = w * math.fabs(x)
print(f"val = {val:.2f}")