Lab Activity 1.3A: Using Variables and Assign Statements Using Variables and + >- Terminal main.py Assign Statements 1 import sys workspace $ python3 main.p y 1. Go to your main.py file. A-Z workspace $ I 2. On the first two lines, declare two variables for the distance in miles and time in hours and assign the values 60 and 3, respectively. 3. In the next two lines, calculate the distance in knots and distance in feet based on the distance in miles. 4. Then, calculate the time in seconds based on the time in hours. 5. Next, calculate the speed in knots, speed in miles per hour, and speed in feet per second. 6. Finally, add print statements to print out the results. 7. In your terminal, run the script by using the python3 main.py nommand
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images