filmov
tv
2022-Spring: Lab 2.6 - Intro to Python

Показать описание
Here we'll go over string and numerical output formatting. There are many similar ways to format output. I'll go over at least 5 of them.
Instructions:
1. Include standard comments for our class as comments:
Your Name
Class + Section + Semester (CIS135 W01/W02 2022 Spring)
File Description
2. Declare the following two variables
A string variable named var_hw which contains the value "hello world"
A numeric variable named var_countdown which contains the value 0.12345
3. Combine a literal string "The value of var_hw is" with the value of the var_hw variable, within a print statement. The resulting output should be as follows...
The value of var_hw is hello world.
Special note don't forget the period at the end
4. Combine a literal string "The countdown is: " with the value of the variable var_countdown, using a placeholder within a print statement to print a series of messages as follows
The countdown is: 0.12345
The countdown is: 0.1235
The countdown is: 0.123
The countdown is: 0.12
The countdown is: 0.1
The countdown is: 0
NOTE: the line that should end in 4 is incorrect, will be explained in the video
5. Finally, use both string and numeric variable placeholders to display the following series of messages:
hello world, the countdown is: 0.12345
hello world, the countdown is: 0.1235
hello world, the countdown is: 0.123
hello world, the countdown is: 0.12
hello world, the countdown is: 0.1
Instructions:
1. Include standard comments for our class as comments:
Your Name
Class + Section + Semester (CIS135 W01/W02 2022 Spring)
File Description
2. Declare the following two variables
A string variable named var_hw which contains the value "hello world"
A numeric variable named var_countdown which contains the value 0.12345
3. Combine a literal string "The value of var_hw is" with the value of the var_hw variable, within a print statement. The resulting output should be as follows...
The value of var_hw is hello world.
Special note don't forget the period at the end
4. Combine a literal string "The countdown is: " with the value of the variable var_countdown, using a placeholder within a print statement to print a series of messages as follows
The countdown is: 0.12345
The countdown is: 0.1235
The countdown is: 0.123
The countdown is: 0.12
The countdown is: 0.1
The countdown is: 0
NOTE: the line that should end in 4 is incorrect, will be explained in the video
5. Finally, use both string and numeric variable placeholders to display the following series of messages:
hello world, the countdown is: 0.12345
hello world, the countdown is: 0.1235
hello world, the countdown is: 0.123
hello world, the countdown is: 0.12
hello world, the countdown is: 0.1