Question
Python 3 #Try out floats and specifiers with the following activities #IMPORTANT! Instructions in each section are not cumulative. The later format specifiers will be
#Try out floats and specifiers with the following activities #IMPORTANT! Instructions in each section are not cumulative. The later format specifiers will be applied to #the original number entered in each section after it is converted to a float. #use the specifier \"${:,.2f}\".format(identifier) to add a dollar sign to the left of a number and two decimal spaces
#Section 1 #Assign the number 1234567 to a variable #Convert the number to a float #Display the number #Note: Assign each of the following formatted outputs to new variable names #Now format the number with a dollar sign to its left and two decimal places using a format specifier #Display the number as formatted in the previous line #Change the number's format to display it with a dollar sign to its left and four decimal places #Display the number as formatted in the previous line #Change the number's format to display NTD and a space to its left and four decimal places #Display the number as formatted in the previous line
#Section 2 #Assign the number 30004000.6735 to a variable #Convert the number to a float #Display the number #Note: Assign each of the following formatted outputs to new variable names #Now format the number with HK$ and a space to its left and three decimal places using a format specifier #Display the number as formatted in the previous line #Now format the number with HK$ and a space to its left and one decimal place using a format specifier #Display the number as formatted in the previous line #Now format the number with AUS$ and a space to its left and one decimal place using a format specifier #Display the number as formatted in the previous line
#Section 3 #Ask the user for a number and assign it to a variable #Convert the number to a float #Display the number #Note: Assign each of the following formatted outputs to new variable names #Now format the number with $ and a space to its left and two decimal places using a format specifier #Display the number as formatted in the previous line #Now format the number with $ and a space to its left and three decimal places using a format specifier #Display the number as formatted in the previous line #Now format the number with JPY and a space to its left and three decimal places using a format specifier #Display the number as formatted in the previous line
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started