• hace 6 meses
Se plantea 3 ejercicios sencillos de conversi贸n de unidades, con el uso de Python, para lo cual se tendr谩 que realizar una conversi贸n previa a una unidad esto es Ejm : 1km * 1mi /1,609 km = 0,62150 mi
Esta constante ira multiplicada, por las unidades que se deseen cambiar, en el ejercicio de cambio de km鈫抦illas, as铆 tambi茅n en otros casos, se podr谩 realizar cualquier conversi贸n, sea de unidades de longitud, fuerza, superficie, capacidad, entre otros.
Codigo.py :
print("Enter Kilometro evaluar:")
km=float(input())
miles=km*(0.621371)
print("\n Equivalente evaluado en millas =",miles)
Transcripci贸n
00:06In this video, we will perform some simple conversions of units of length and one unit
00:11from force, such as newtons to kilograms, this in Python was done by converting to
00:17a unit in order to obtain its equivalent constant conversion thus we have kilometers
00:22to miles, kilometers, meters, newtons, kilograms. For this, we begin by creating a folder in
00:29desktop called conversion, we go to the Visual Studio file explorer and create a file
00:35called point pg conversion is the extension of python and we type the input message
00:41compress between kilometers to be evaluated
00:51Next, the kilometer will be equal to a floating-point variable; that is, it allows representing a number
00:56positive or negative with decimals within an input that allows receiving information from the user
01:02independent of its entry
01:08Then we write miles equals kilometers times the conversion constant to a unit
01:17and finally print the result in miles
01:27And when we press play on the console in Visual Studio, we can see that the programming is correct.
01:32We enter a value to evaluate, in this case 30 kilometers, and it gives us the result in miles: 18.64
01:44Now, to convert kilometers to meters, we simply change the data already entered.
01:49This is, we have the input message from the previous exercise, compress between kilometers to be evaluated
01:56Next, the kilometers will be equal to a floating-point variable; this allows us to represent a
02:02A positive or negative number with decimals within an input field that allows receiving information from the user.
02:08independent of its input, then we write meters equals kilometers times the constant of
02:14conversion to a unit of one thousand and finally print the result in meters
02:21and we press play on the console in Visual Studio, we can see that the programming is correct, we enter
02:26a value to evaluate in this case 50 kilometers and gives us the result in meters 50 thousand
02:33Now, to convert from newtons to kilograms, we simply change the data already entered.
02:38This means we have the input message from the previous exercise with print enter newtons to be evaluated next
02:45Newtons will be equal to a floating-point variable, then we write kilograms equals newtons times
02:50the conversion constant to a unit of 0.1204 and finally print the result in kilograms
03:09and we press play on the console in Visual Studio, we can see that the programming is correct, we enter
03:15a value to evaluate in this case 30 newtons and gives us the result in kilograms 3.0612
03:24That's all. If you found the video helpful, don't forget to subscribe.
Comentarios

Recomendada