CHALLENGE ACTIVITY 4.27.1: Complete the program to make a table of integers and their square roots. 599740.4592866.qx3zqy7 Complete the following program to make a table of integers from 0 to n (inclusive) and their square roots. The table should be formatted like this one and display the square roots to the same number of decimal places: In | Root of n 0 | 0.000000 1 | 1.000000 2 | 1.414214 Empty print statements are included for output formatting. 1 from math import sqrt 2 3 n = int(input("Enter a positive integer: ")) 4 print() 5 6 print(" In Root of n") 7 print("----|----------") 8 9 for i in range(n + 1): 10 11 root sqrt(i) print(f"{i:3d} | {root:.6f}") 87 | 9.327379 88 | 9.380832 89 | 9.433981 90 | 9.486833 91 | 9.539392 92 | 9.591663 93 | 9.643651 94 | 9.695360 95 | 9.746794 96 | 9.797959 97 | 9.848858 98 | 9.899495 99 | 9.949874 100 | 10.000000
CHALLENGE ACTIVITY 4.27.1: Complete the program to make a table of integers and their square roots. 599740.4592866.qx3zqy7 Complete the following program to make a table of integers from 0 to n (inclusive) and their square roots. The table should be formatted like this one and display the square roots to the same number of decimal places: In | Root of n 0 | 0.000000 1 | 1.000000 2 | 1.414214 Empty print statements are included for output formatting. 1 from math import sqrt 2 3 n = int(input("Enter a positive integer: ")) 4 print() 5 6 print(" In Root of n") 7 print("----|----------") 8 9 for i in range(n + 1): 10 11 root sqrt(i) print(f"{i:3d} | {root:.6f}") 87 | 9.327379 88 | 9.380832 89 | 9.433981 90 | 9.486833 91 | 9.539392 92 | 9.591663 93 | 9.643651 94 | 9.695360 95 | 9.746794 96 | 9.797959 97 | 9.848858 98 | 9.899495 99 | 9.949874 100 | 10.000000
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
how can the code be fixed when plug in 100 in the program 9 and 0 from 10 could be alligned |. I changed spacing from the bar but still I input the spacing was still incorrect
from math import sqrt
n = int(input("Enter a positive integer: "))
print()
print(" n | Root of n")
print("----|----------")
for i in range(n + 1):
root = sqrt(i)
print(f"{i:3d} | {root:.6f}")

Transcribed Image Text:CHALLENGE
ACTIVITY
4.27.1: Complete the program to make a table of integers and their square roots.
599740.4592866.qx3zqy7
Complete the following program to make a table of integers from 0 to n (inclusive) and their square roots. The table should be
formatted like this one and display the square roots to the same number of decimal places:
In | Root of n
0 | 0.000000
1 | 1.000000
2 | 1.414214
Empty print statements are included for output formatting.
1 from math import sqrt
2
3 n =
int(input("Enter a positive integer: "))
4 print()
5
6 print(" In Root of n")
7 print("----|----------")
8
9 for i in range(n + 1):
10
11
root sqrt(i)
print(f"{i:3d} | {root:.6f}")

Transcribed Image Text:87 | 9.327379
88 | 9.380832
89 | 9.433981
90 | 9.486833
91 | 9.539392
92 | 9.591663
93 | 9.643651
94 | 9.695360
95 | 9.746794
96 | 9.797959
97 | 9.848858
98 | 9.899495
99 | 9.949874
100 | 10.000000
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 2 steps

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