Python Lab 2a: Input and output 1. Ask the user to enter their name. Then say hello and repeat their name. 2. Ask the user to enter their age. Print out their age 5 years from now. 3. Use concatenation and str() to print a message telling the user how old they will be in 5 years. 4. Ask the user to enter in values that might be floating point. 5. Print out the result of the calculation in a single print statement, using concatenation. 6. If Time In Python, the input() function is used to accept input. The result is stored as a string type. name = input ('what is your name?") print ('Hello + name) ' To be able to add 5 to the user input, it has to be converted to an integer. x= int(input (what is your age?") print (x + 5) When you are printing out a string message and want to concatenate a number onto the string, use str() to convert a numeric value to a string. If the user entered 27, your output should be similar to the following: In 5 years you will be 32 years old Let's calculate the amount of pay an hourly worker will get for working in a week. Ask the user to enter in the number of hours worked, convert this to a floating point value, and store this in a variable. Enter the number of hours worked: 33.7 Ask the user to enter in their hourly wage, but not with the $, convert this to a floating point value, and store the result in a variable. Enter your hourly wage, without the $: 11.32 Calculate their weekly paycheck and print out a message, using one print statement, and using concatenation. Your gross pay this week is $ 381.484 If you have time, search on the web for a way to round to 2 decimal places. Change your output to show just 2 places after the decimal.

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
icon
Concept explainers
Question
100%
Python Lab 2a: Input and output
1. Ask the user to enter their name. Then say hello and repeat their name.
2. Ask the user to enter their age. Print out their age 5 years from now.
3. Use concatenation and str() to print a message telling the user how old they will be in 5 years.
4. Ask the user to enter in values that might be floating point.
5. Print out the result of the calculation in a single print statement, using concatenation.
6. If Time
In Python, the input() function is used to accept input. The result is stored as a string type.
name = input ('what is your name?')
print ('Hello ' + name)
To be able to add 5 to the user input, it has to be converted to an integer.
x = int(input ('what is your age?')
print (x + 5)
When you are printing out a string message and want to concatenate a number onto the string, use str() to convert a numeric value to a
string.
If the user entered 27, your output should be similar to the following:
In 5 years you will be 32 years old
Let's calculate the amount of pay an hourly worker will get for working in a week. Ask the user to enter in the number of hours worked,
convert this to a floating point value, and store this in a variable.
Enter the number of hours worked: 33.7
Ask the user to enter in their hourly wage, but not with the $, convert this to a floating point value, and store the result in a variable.
Enter your hourly wage, without the $: 11.32
Calculate their weekly paycheck and print out a message, using one print statement, and using concatenation.
Your gross pay this week is $ 381.484
If you have time, search on the web for a way to round to 2 decimal places. Change your output to show just 2 places after the decimal.
Transcribed Image Text:Python Lab 2a: Input and output 1. Ask the user to enter their name. Then say hello and repeat their name. 2. Ask the user to enter their age. Print out their age 5 years from now. 3. Use concatenation and str() to print a message telling the user how old they will be in 5 years. 4. Ask the user to enter in values that might be floating point. 5. Print out the result of the calculation in a single print statement, using concatenation. 6. If Time In Python, the input() function is used to accept input. The result is stored as a string type. name = input ('what is your name?') print ('Hello ' + name) To be able to add 5 to the user input, it has to be converted to an integer. x = int(input ('what is your age?') print (x + 5) When you are printing out a string message and want to concatenate a number onto the string, use str() to convert a numeric value to a string. If the user entered 27, your output should be similar to the following: In 5 years you will be 32 years old Let's calculate the amount of pay an hourly worker will get for working in a week. Ask the user to enter in the number of hours worked, convert this to a floating point value, and store this in a variable. Enter the number of hours worked: 33.7 Ask the user to enter in their hourly wage, but not with the $, convert this to a floating point value, and store the result in a variable. Enter your hourly wage, without the $: 11.32 Calculate their weekly paycheck and print out a message, using one print statement, and using concatenation. Your gross pay this week is $ 381.484 If you have time, search on the web for a way to round to 2 decimal places. Change your output to show just 2 places after the decimal.
Expert Solution
steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Knowledge Booster
Operators
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
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