224k views
1 vote
Write a statement if iVal is assigned 5 and fVal is assigned 2.4

User Pmilosev
by
3.1k points

1 Answer

11 votes

Answer:

print("i="+str(iVal)+" f="+str(fVal))

Step-by-step explanation:

Given


iVal = 5


fVal = 2.4

See attachment

Required

Write a statement that outputs i=5 f=2.4

From the output format, the following should be noted.

- i = and f= are string literals, so they will be in double quotes in the print statement

- 5 and 2.4 represent the values of iVal and fVal respectively

- We will make use of + (concatenation operator) to concatenate all data to be printed

So, the print statement (in Python) is:

print("i="+str(iVal)+" f="+str(fVal))

The function of the str keyword as used above is to convert iVal and fVal to string values, so that the print statement will be executed without error

Write a statement if iVal is assigned 5 and fVal is assigned 2.4-example-1
User Rajesh Hatwar
by
3.7k points