Académique Documents
Professionnel Documents
Culture Documents
a=0
b=0
for i in range(4):
x = int(input("number of step :"))
y = (input("Enter the direction :"))
if y=="up":
a=a+x
elif y=="right":
a=a+x
elif y=="down":
b=b+x
elif y=="left":
b=b+x
print(a,b)
print("area covered by Robot :",(a**2+b**2))
2. Data of XYZ company is stored in sorted list. Write a program for searching
specific data from that list.
for i in range(1):
if item in company_data:
print('Item is in company data')
break
else:
print("data is not available")
4.
from math import radians,sin,cos,acos
import math
x=6371*(math.acos(math.sin(Point_A_Lat)*math.sin(Point_B_Lat)
+math.cos(Point_A_Lat)*math.cos(Point_B_Lat)*math.cos(Point_A_Long-Point_B_Long)))
print("The distance is:",x,"km")
5.Design a software for bank system. There should be options like cash withdraw,
cash credit and change password. According to user input, the software should
provide required output
ATM_Password="1234"
amount_in_bank=50000
if ATM_Password in password:
print("welcom to the bank ___xyz____")
z = input("do you want to withdaw amount :")
if z == "yes":
withdraw = int(input("Please input the amount to withdraw :"))
if withdraw <= amount_in_bank:
print("please collect your cash :", withdraw)
amount_in_bank=amount_in_bank-withdraw
print("Available balance in Account :",amount_in_bank)
else:
print("You dont have limit")
else:
m = input("do you want to credit amount :")
if m == "yes":
credit = int(input("Please input the amount to credit :"))
amount_in_bank += credit
print("Account has been credit with :", credit)
print("your balance in Account=", amount_in_bank)
else:
n = input("Do you want to change the password :")
if n == 'yes':
if ATM_Password in Old_pass:
new_pass = input("Please enter new 4 digit password :")
print("your new passowrd is =",new_pass)
else:
print("password is incorrect")
else:
print("password is incorrect")
else:
print("Please try again")
6. Write a program which will find all such numbers which are divisible by 7 but
are
not a multiple of 5, between 2000 and 3200 (both included). The numbers obtained
should be printed in a comma-separated sequence on a single line.
for i in range(2000,3200):
if i%7==0 and i%5==0:
print(i)
7.
8.Write a program that calculates and prints the value according to the given
formula:
Q = Square root of [(2 * C * D)/H]
Following are the fixed values of C and H: C is 50. H is 30.
D is the variable whose values should be input to your program in a commaseparated
sequence.
import math
C= 50
H = 30
Ds = []
result =[]
Dv=input("enter the value of D")
Ds=Dv.split(",")
Ds = [int(i) for i in Ds]
i=0
l = len(Ds)
while(i<l):
Q = round(math.sqrt((2*C*Ds[i])/H))
result. append(Q)
i+=1
print("output=",result)
10.Write a program that accepts a comma separated sequence of words as input and
prints the words in a comma-separated sequence after sorting them alphabetically.
Suppose the following input is supplied to the program:
without,hello,bag,world
Then, the output should be:
bag,hello,without,world
print(y)
11..Write a program that accepts sequence of lines as input and prints the lines
after
making all characters in the sentence capitalized.
Suppose the following input is supplied to the program:
x=input("Enter the wordd ")
y=[]
for i in range(1):
y.append(x.upper())
print(y)
14.Write a program that accepts a sentence and calculate the number of upper case
letters and lower case letters.