Write a function that takes a list of dollar values separated by commas, converts each number from dollars to pounds (at an exchange rate 0.667 dollars per pound) and prints the results in a com- ma-separated list. Each converted value should have the £ symbol in front of it. This symbol can be obtained by passing the ASCII value of the symbol 156 to the chr function, which returns a string

composed of that character. Ambitious programmers can attempt to do the conversion all in one statement.

What will be an ideal response?


```
# Convert comma-separated list of dollar values to comma-
# separated list of pound values.


# convert dollar value to pounds
def convertToPound( dollar ):
return chr( 156 ) + str( dollar / 0.667 )

dollars = raw_input( \
"Input comma-separated list of dollar values: " )

dollars = dollars.split( "," )
poundsList = []

for dollar in dollars:
pounds = convertToPound( float( dollar ) )
poundsList.append( pounds )

print "List of values in pounds: %s " % ",".join( poundsList )
```
Input comma-separated list of dollar values: 8, 16, 12
List of values in pounds: £11.9940029985,£23.988005997,
£17.9910044978

Computer Science & Information Technology

You might also like to view...

This type of connection is always used for dial-up.

A. PPPoE B. DHCP C. PPP D. PPTP

Computer Science & Information Technology

In the Configure Drivers window, the driver that can only be used to configure modules newer than the 1756-ENET is the ____________________ driver.

What will be an ideal response?

Computer Science & Information Technology

Which of the following is a security concern regarding users bringing personally-owned devices that they connect to the corporate network?

A. Cross-platform compatibility issues between personal devices and server-based applications B. Lack of controls in place to ensure that the devices have the latest system patches and signature files C. Non-corporate devices are more difficult to locate when a user is terminated D. Non-purchased or leased equipment may cause failure during the audits of company-owned assets

Computer Science & Information Technology

Of the two sets of code below, which is more efficient?  Why?Set #1if (x == 1)   cout

What will be an ideal response?

Computer Science & Information Technology