Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

print (m. Biust (30, )) print (m) The above code will generate the following output: What is the time? ++++What is the time?ti! What is

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
print (m. Biust (30," ")) print (m) The above code will generate the following output: What is the time? ++++What is the time?ti! What is the time?******** What is the time? What is the time? Do you see how it works? center(), ljust(), and rjust() are three functions. When you use one of them, you should type a dot right after the string you want to display, and type the name of the function. Each of the function takes 2 parameters. The first parameter is the width of the content, while the second parameter is the placeholder character. You can also use them to adjust the alignment of string constants. For example, print("Ha". I just (10, "x")) will show xxxxxxxxHa will show xxxxxxxxHa However, these three functions do not work with numeric values. They only work with strings. a = 10 print (a.riust (10, "x")) will end up in a syntax error. To display a numeric value in a certain alignment, you can convert it to a string first: a = 10 b = str(a) print (b.rjust (10, "x")) will show XXXXXXXX10 pareng- Font Paragraph Styles Exercise 4 1. Write a program to display the following content on the screen. You must declare a string that spans over multiple lines. Hello. How are you? 2. Write a program to display the above content on the screen. You must not declare a string that spans over multiple lines. You must use the new line character. 3. Write a program to compute the interest of your bank account. Assuming that you initially had $3254.50 in your account, and the annual interest rate is 3.254. Display your interest income of this account after a year. The amount must be displayed with 2 decimal places. 4. Write a program to ask the user to enter their height in inches, and convert it to feet and inches. You do not need to consider the situation when the user types non-numeric value or negative value. For example, your program should run like this: How tall are you? 69 Your height is 5'9" D. Focus Fi A A A A A-D-A- E E - 21 - cr| bct AaBbccc 1 Normal 1 No Spac... Heading 1 Heading 2 Title Subtitle Paragraph Styles inches, and convert it to feet and inches. You do not need to consider the situation when the user types non-numeric value or negative value. For example, your program should run like this: How tall are you? 69 Your height is 5'9". Hint: (1) Use the input function to get the user input, and use the int() function to convert it to an int. (2) Then use the integer division operator and remainder operator to complete the conversion. One foot is twelve inches. (3) When you display the height, and are special characters and need special care

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

Students also viewed these Databases questions

Question

When should the last word in a title be capitalized?

Answered: 1 week ago

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago