-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek_1.txt
50 lines (50 loc) · 2.88 KB
/
week_1.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
resource url?
QUESTION ----------------
Write a program to convert strings to an integer and float and display its type.Sample Input:1010.9Sample Output:10,<class 'int'>10.9,<class 'float'>
------------------ANSWER
n=int(input())
n1=float(input())
print(n,type(n),sep=',')
print("%.1f"%n1,type(n1),sep=',')
------------------------------
QUESTION ----------------
Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of his basic salary, and his house rent allowance is 20% of his basic salary. Write a program to calculate his gross salary.Sample Input:10000Sample Output:16000
------------------ANSWER
n=int(input())
a=int(0.4*n)
h=int(0.2*n)
print(n+a+h)
------------------------------
QUESTION ----------------
Write a simple python program to find the square root of a given floating point number. The output should be displayed with 3 decimal places.Sample Input:8.00Sample Output:2.828
------------------ANSWER
n=float(input())
s=n**0.5
print("%.3f"%s)
------------------------------
QUESTION ----------------
Alfred buys an old scooter for Rs. X and spends Rs. Y on its repairs. If he sells the scooter for Rs. Z (Z>X+Y). Write a program to help Alfred to find his gain percent. Get all the above-mentioned values through the keyboard and find the gain percent.Input Format:The first line contains the Rs XThe second line contains Rs YThe third line contains Rs ZSample Input:1000025015000Sample Output:46.34 is the gain percent.
------------------ANSWER
x=int(input())
y=int(input())
z=int(input())
gain=((z-(x+y))/(x+y))*100
print("%.2f"%gain,"is the gain percent.")
------------------------------
QUESTION ----------------
In many jurisdictions, a small deposit is added to drink containers to encourage people to recycle them. In one particular jurisdiction, drink containers holding one liter or less have a $0.10 deposit and drink containers holding more than one liter have a $0.25 deposit. Write a program that reads the number of containers of each size(less and more) from the user. Your program should continue by computing and displaying the refund that will be received for returning those containers. Format the output so that it includes a dollar sign and always displays exactly two decimal places.
------------------ANSWER
ll1=int(input())
ml1=int(input())
ll2=ll1*0.10
ml2=ml1*0.25
print("Your total refund will be $%.2f."%(ll2+ml2))
------------------------------
QUESTION ----------------
Justin is a carpenter who works on an hourly basis. He works in a company where he is paid Rs 50 for an hour on weekdays and Rs 80 for an hour on weekends. He works 10 hrs more on weekdays than weekends. If the salary paid for him is given, write a program to find the number of hours he has worked on weekdays and weekends.
------------------ANSWER
s=int(input())
x=abs((s-500)/130)
print("weekdays %.2f"%(x+10))
print("weekend %.2f"%x)
------------------------------