Fun math practice You Python programming teacher wants to see you make a program that accepts input for a name and a few numbers from the user, and then display some fun output using some of the math and built in functions you have learned to use in python.

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
icon
Related questions
Question
Second picture is the example that's how my professor wanted to be look like similar to that
e
Tools
View
Document1 - Word
Fun math practice
1. 8 squared is 64
You Python programming teacher wants to see you make a program that accepts input for a name and a
few numbers from the user, and then display some fun output using some of the math and built in functions
2. The square root of 144 is 12
3.7.75 times pi is 24.347343065320896
4. 8 can be displayed as a real number like this: 8.0
5. 7.75 can be displayed rounded to only 1 decimal like this: 7.8
you have learned to use in python.
*Make sure to import the math library before def main and use for square root and the value of pi.
6. The integer value of 7.75 is 7
*Also remember that the things underlined means the user is typing in some value there, and the math will
Hope you had fun seeing some random math that we can do with Python!
have to be using their value not the sample values.
Please write an algorithm first (no python syntax at all) that will describe the steps needed to ultimately
have the output below. Remember to never mention importing a library in an algorithm.
Then write the correct Python code under each algorithm step to make the program below. Add any addi-
tional code needed (like importing the math library) and comments a programmer might add.
Example output - Make it look like this with the user's name and numbers:
Welcome to my fun math program!
First, what is your name? Bob
Hello Bob. Next I am going to ask you for 3 numbers and show you some fun math using them.
Enter first number and make sure it is a whole number: 8
Enter second number and make sure it is a whole number with 3 digits: 144
Enter third number and make sure it is a real number with 2 decimal places: 7.75
Okay Bob, are you ready to see some random math..
reens 1-2 of 2
P Type here to search
圖
Transcribed Image Text:e Tools View Document1 - Word Fun math practice 1. 8 squared is 64 You Python programming teacher wants to see you make a program that accepts input for a name and a few numbers from the user, and then display some fun output using some of the math and built in functions 2. The square root of 144 is 12 3.7.75 times pi is 24.347343065320896 4. 8 can be displayed as a real number like this: 8.0 5. 7.75 can be displayed rounded to only 1 decimal like this: 7.8 you have learned to use in python. *Make sure to import the math library before def main and use for square root and the value of pi. 6. The integer value of 7.75 is 7 *Also remember that the things underlined means the user is typing in some value there, and the math will Hope you had fun seeing some random math that we can do with Python! have to be using their value not the sample values. Please write an algorithm first (no python syntax at all) that will describe the steps needed to ultimately have the output below. Remember to never mention importing a library in an algorithm. Then write the correct Python code under each algorithm step to make the program below. Add any addi- tional code needed (like importing the math library) and comments a programmer might add. Example output - Make it look like this with the user's name and numbers: Welcome to my fun math program! First, what is your name? Bob Hello Bob. Next I am going to ask you for 3 numbers and show you some fun math using them. Enter first number and make sure it is a whole number: 8 Enter second number and make sure it is a whole number with 3 digits: 144 Enter third number and make sure it is a real number with 2 decimal places: 7.75 Okay Bob, are you ready to see some random math.. reens 1-2 of 2 P Type here to search 圖
11:47
A l 86%i
2-2-2021 program.py- C:\Users\mcucc\OneDrive\Desktop\COP100
File Edit Format Run Options Window Help
conE, 2, 2021
#program to calculate the number of miles trave
#based on user input of kilometers
OPT #define main function
def main () :
#Dclare constant to store conversion
conversion = 0.6214
#Declare and intialize string variabl
name=
#Declare and intialize real variable
kilometers = miles = 0.0
#Display introduction
print("welcome to my miles conversion
print ("i will ask for a number of kil
print ("display the number of miles yo
r.
r.
#prompt user for name
name = input ("what is your name?")
#prompt user for kilometers traveled
kilometers = float(input ("how many kilometer
#set miles = kilometers * conversion
miles = kilometers * conversion
#Display name and miles to user
#user commas in print
print ("great job", name,
#now use concatenation
print ("great job" + name +
your've traviled'
your've travile
#.format method is newer, but sill not the r
print ("great job", name,
" you've traveled C
#f mormatting is the way to go
print (f"great job (name), you've traveld (mi
#Display outro
print ("\nthanks you for using my program! ")
main ()
Transcribed Image Text:11:47 A l 86%i 2-2-2021 program.py- C:\Users\mcucc\OneDrive\Desktop\COP100 File Edit Format Run Options Window Help conE, 2, 2021 #program to calculate the number of miles trave #based on user input of kilometers OPT #define main function def main () : #Dclare constant to store conversion conversion = 0.6214 #Declare and intialize string variabl name= #Declare and intialize real variable kilometers = miles = 0.0 #Display introduction print("welcome to my miles conversion print ("i will ask for a number of kil print ("display the number of miles yo r. r. #prompt user for name name = input ("what is your name?") #prompt user for kilometers traveled kilometers = float(input ("how many kilometer #set miles = kilometers * conversion miles = kilometers * conversion #Display name and miles to user #user commas in print print ("great job", name, #now use concatenation print ("great job" + name + your've traviled' your've travile #.format method is newer, but sill not the r print ("great job", name, " you've traveled C #f mormatting is the way to go print (f"great job (name), you've traveld (mi #Display outro print ("\nthanks you for using my program! ") main ()
Expert Solution
Program

#Program to enter name and few number and display some fun outputs using math built in function

import math

#define main function
def main():
    #display welcome messsage
    print("----------------------------------------")
    print("Welcome to my fun math program!")
    print("----------------------------------------")

    #prompt user to enter name
    name = input("\nFirst what is your name? ")

    #display message, ask user to enter three numbers
    print(f"\nHello {name}. Next I am going to ask for three numbers and show you some fun math using them")

    #prompt user to enter three numbers
    first_num = int(input("\nEnter first number and make sure it is a whole number: "))
    second_num = int(input("\nEnter second number and make sure it is a whole number with three digit: "))
    third_num = float(input("\nEnter third number and make sure it is a real number with two decimal places: "))

    print(f"\nOkay {name}, you are ready to see some random math...")

    #display all math operations
    print(f"\n1. {first_num} squared is {first_num*first_num}")
    print(f"2. The square root of {second_num} is {math.sqrt(second_num)}")
    print(f"3. {third_num} times pi is {third_num*math.pi}")
    print(f"4. {first_num} can be displayed as real number like this {float(first_num)}")
    print(f"5. {third_num} can be displayed rounded to 1 decimal places like this", "{:.1f}".format(third_num))
    print(f"6. The integer value of {third_num} is {int(third_num)}")
    

#calling main program
main()

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Decision Making Process
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education