Hi! I need help writing out the pseudocode and codes for these programs. All instructions are included and the programs are in python! Any help is appreciated. Thanks! program5_1.py Write a program that displays a table of ten distance equivalents in miles and kilometers. See Example output. You must generate the table by running a function inside a loop in main. Generate a random integer from 10 to 60, inclusive, in each loop cycle. Use this latter value as the miles argument to the function. The function must then print a line in the table. Repeat: The function prints the table. Print the miles in a column 5 characters wide with 2 decimals and the kilometers in a column 13 characters wide with 5 decimals. Use the column formatting concepts at the end of Chapter 2, not tabs or other methods not in this course. Example output MILES KILOMETERS 52.00 83.68568 11.00 17.70274 40.00 64.37360 21.00 33.79614 14.00 22.53076 23.00 37.01482 48.00 77.24832 22.00 35.40548 15.00 24.14010 16.00 25.74944 program5_2.py Write another program that generates another table with the same columns and decimals but by using a function that returns the kilometers for a specified miles parameter. Use a loop in main and generate random integers as before, but catch the value returned by the function and use it in the loop to print a line of the table. Repeat: The table is printed in main. program5_3.py Write a program about triangles. You need two files, a module file and an executable file with a main method. The module file (defines two functions): One function that takes the three sides of a triangle as arguments. It returns True if the sides define a right triangle and False if it doesn't. HINT: This is easiest with a Math module function. The other function must use Heron's Formula to calculate and return the area of a triangle. Learn about Heron's formula online. The main file: Prompt the user to enter the three sides (longest first) of the triangle. Use integers only. Make sure that no side is longer than the sum of the other two sides. Call the function that returns a boolean and use it to output whether the triangle is a right triangle, or not. Call the function that returns the area. Display the value returned with two decimal places. Two Example outputs Enter longest side of the triangle 14 Enter any another side of the triangle 11 Enter third side of the triangle 10 Not a right triangle Area is 54.64 >>> Enter longest side of the triangle 10 Enter any another side of the triangle 8 Enter third side of the triangle 6 Triangle is a right triangle Area is 24.00
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
Hi! I need help writing out the pseudocode and codes for these programs. All instructions are included and the programs are in python! Any help is appreciated. Thanks!
program5_1.py
Write a
Example output
program5_2.py
Write another program that generates another table with the same columns and decimals but by using a function that returns the kilometers for a specified miles parameter. Use a loop in main and generate random integers as before, but catch the value returned by the function and use it in the loop to print a line of the table. Repeat: The table is printed in main.
program5_3.py
Write a program about triangles. You need two files, a module file and an executable file with a main method.
The module file (defines two functions):
- One function that takes the three sides of a triangle as arguments. It returns True if the sides define a right triangle and False if it doesn't. HINT: This is easiest with a Math module function.
- The other function must use Heron's Formula to calculate and return the area of a triangle. Learn about Heron's formula online.
Prompt the user to enter the three sides (longest first) of the triangle. Use integers only. Make sure that no side is longer than the sum of the other two sides. Call the function that returns a boolean and use it to output whether the triangle is a right triangle, or not. Call the function that returns the area. Display the value returned with two decimal places.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps