Write a program that will show you how the two types of print formatting works under the data type strings. 1. Type the following code on your Python script. 1 name = input('Type in your name: ') 2 age=input('Tell me your age: ') Loc=input('Where are you from? ') 3 4 5 print("Hi, I am {}, {} years old, from {}." .format(name, age, Loc)) print("Hi, I am {2}, {0} years old, from {1}." .format(age, loc, name)) 7 print (f"Hi, I am {name}, {age} years old, from {Loc}.") 6 Page 3 2. Run the program and write below the presented output in the console. Are there any difference on the outputs? 3. Explain the code in line 6. 4. What do you think between the two is the best way of print formatting with strings? Why?
Write a program that will show you how the two types of print formatting works under the data type strings. 1. Type the following code on your Python script. 1 name = input('Type in your name: ') 2 age=input('Tell me your age: ') Loc=input('Where are you from? ') 3 4 5 print("Hi, I am {}, {} years old, from {}." .format(name, age, Loc)) print("Hi, I am {2}, {0} years old, from {1}." .format(age, loc, name)) 7 print (f"Hi, I am {name}, {age} years old, from {Loc}.") 6 Page 3 2. Run the program and write below the presented output in the console. Are there any difference on the outputs? 3. Explain the code in line 6. 4. What do you think between the two is the best way of print formatting with strings? Why?
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
PYTHON
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 5 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education