Assignment AB

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

5.

#WAP to calculate the speed of a car in meter/seconds

distance=eval(input("Enter the distance in meter: "))


time=eval(input("Enter the time in seconds: "))
speed= distance/time
print("speed is", "speed",(distance/time))

Output: Enter the distance in meter: 20


Enter the time in seconds: 2
speed is speed 10.0

12. #WAP to print sequence of powers of 5 from 5 power 0 to 5 power n in separate lines.

num=int(input("enter a number"))
for j in range(num+1):
print(" ",5**j," ")

Output: enter a number6


1
5
25
125
625
3125
15625

11. #WAP to calculate the square of only those numbers whose least significant digit is 5.

number=int(input("enter a number"))
if number%10==5:
print("square value: ",number*number)
else:
print("least significant number is not 5")

Output: enter a number25


square value: 625

You might also like