0% found this document useful (0 votes)
10 views1 page

Assignment AB

The document contains three code snippets that calculate speed from distance and time, print powers of 5 up to a given number, and calculate the square of a number if its least significant digit is 5.

Uploaded by

Sanket Andhare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Assignment AB

The document contains three code snippets that calculate speed from distance and time, print powers of 5 up to a given number, and calculate the square of a number if its least significant digit is 5.

Uploaded by

Sanket Andhare
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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