You are on page 1of 3

will->ser�

purpose -> prop�sito


do -> hacer
always -> siempre
manner-> conducta, manera, modo
themselves -> si mismos
trust -> confiar
taking -> tomando
harm -> da�o
their -> su
fall -> caer
sometime -> a veces
who -> quien
become -> volverse
toolset -> conjunto de herramientas
weaknesses -> debilidades
countermeasures -> contramedidas
those -> aquell@s, es@s
owner -> propietario
otherwise -> de otra manera
because -> porque

Luis Julio5:06
II (15 Points)

Write a Python program:

In main function the user is asked to enter distance traveled and time and then
send this information to a Python function that calculates and returns the speed of
a car. The function will need to have parameters for distance traveled and time
taken for the travel. The speed is calculated as:

Speed = distance traveled / time

In the main function show how to call this function in a print statement.

***********************************************************************************
***
def principalFunction(distanceTravel, time):
//Pide los datos y los cambia a float para poder hacer la division
distanceTravel = float(input("Please enter the distance: "))
time = float(input("Please enter the time: "))
speed = SpeedFunction(distanceTravel,time)
//Imprime la velocidad ya calculada
print("The speed is: " + str(speed))

//Funcion que me calcula la velocidad


def SpeedFunction(a,b):
//verifica si b = 0, ya que no se puede dividir por 0
if b == 0:
return print("it is not possible to calculate the speed")
else:
c = a/b
return c

c = 0
d = 0
principalFunction(c,d)

***********************************************************************************
****

III (15 Points)

Write code using Python. Make sure that the code is well commented to explain what
your steps are doing. Write a program that asks user to enter a number between 2 -
9. If the user enters any number that is not between 2 and 9 then you must give the
message "Incorrect Input" and stop the program. If the number is between 2 and 9
then display tables of that number 1 to 10 as indicated below:

For example if the user enters 3 the output should look like:

Table of 3 is: 3 6 9 1
Table of 3 is: 3 6 9 12 15 18 21 24 27 30

***********************************************************************************
*******

cond = True
while cond == True:
a = int(input("Ingrese un numero entre 2 y 9: "))
if a < 2:
print("Entrada incorrecta")
cond = False
if a > 9:
print("Entrada incorrecta")
cond = False
else:
print("La tabla del "+str(a)+" es:", end ="")
for i in range(1,11):
z = a*i
print(z," ",end="")
print("\n")
***********************************************************************************
*****

You might also like