All coding Solution
13.1K subscribers
185 photos
181 files
36 links
Download Telegram
PYTHON IRA
1. 2003
2. All of the options
3. Reinforcement learning
4. All the evidence
5.D
6.C
27.allof the above
44.byte code
45. Runtime environment

Telegram- https://t.me/Allcodingsolution
Java
1. 2018
2.option 1 and 2
4.true
5. No
7. Value added service
8.allofthe above
9. a, b, c
10. 1354
20. True
15.B

26. B
27. C
28. D
29. B
30. True
31. B
32. D
33.C
34. B
35. A
38. A
39. Default
44.byte code
45.runtime environment
47. A

Telegram- https://t.me/Allcodingsolution
Java
1. 2018
2.option 1 and 2
4.true
5. No
7. Value added service
8.allofthe above
9. a, b, c
10. 1354
20. True
14. Path
15.B
23. B
25.b

26. B
27. C
28. D
29. B
30. True
31. B
32. D
33.C
34. B
35. A
38. A
39. Default
44.byte code
45.runtime environment
47. A
50. Compilation error
48 . D

43 c

14.path

Telegram- https://t.me/Allcodingsolution
Python
1. C
2. A
3. B
4. A
5. B
6. C
7. A
8. D
9. B
10. A
11. A
12. C
47. D
48. A
49. D
50. B

26. A
27. B
28. B
29. 1
30.1
31.b
32.b
43.a
44.a
45.a
46.d

Telegram- https://t.me/Allcodingsolution
class Employee:
def _init_(self,n,d,s,lb):
self.name=n
self.designation=d
self.salary=s
self.leavesbalance=lb

class Organization:
def _init_(self,elist):
self.employee_list=elist

def display_leaves(self,name):
for i in self.employee_list:
if i.name==name:
for a,b in i.leavesbalance.items():
print(a,":",b)

def checkLeaveEligibility(self,ename,tl,nol):
for i in self.employee_list:
if i.name==ename:
for a,b in i.leavesbalance.items():
if a==tl:
if b>=nol:
i.leavesbalance[a]=b-nol
return 'True'
else:
return 'False'
return 'not found'
if _name_ == '_main_':
elist=[]
num=int(input())
for i in range(num):
leaves={}
name=input()
designation=input()
salary=int(input())
ltype=int(input())
for i in range(ltype):
key=input()
value=int(input())
leaves[key]=value
elist.append(Employee(name,designation,salary,leaves))
obj=Organization(elist)
empname=input()
Itype=input()
nol=int(input())
if(obj.checkLeaveEligibility(empname,Itype,nol)=='True'):
print("leave granted")
obj.display_leaves(empname)
elif(o.checkLeaveEligibility(empname,Itype,nol)=='False'):
print("leave not granted")
obj.display_leaves(empname)
elif(obj.checkLeaveEligibility(empname,Itype,nol)=='not found'):
print("leave not granted")
print("Employee not found")


Employee code

Telegram- https://t.me/Allcodingsolution
awk ' BEGIN{FS=#;count=0;}{

if($4>300){
count=count+$3;}

}END{
print "Total count:" count;}
else
{
print "No soap found with cost above 300";
}
}'


Soap management unix

Telegram- https://t.me/Allcodingsolution
class Food:
def init(self,name,protien,fat,carb):
self.name=name
self.protien=protien
self.fat=fat
self.carb=carb

class Nutrition:
def init(self,status,lfood):
self.status=status
self.lfood=lfood
def setEnergy(self):
result=[]
for i in lfood:
for k,v in status.items():

temp=(i.protien+i.fat+i.carb)
if(temp>=v[0] and temp<=v[1]):
result.append(str(i.name)+" - "+str(temp)+" - "+k)
if(len(result)==0):
return None
else:
return result
def getEnergyRichFood(self,checkenergy):
ans=[]
for i in lfood:
temp=(i.protien+i.fat+i.carb)
if(temp<=checkenergy):
ans.append(i.name+" : "+str(temp))
if(len(ans)==0):
return None
else:
return ans
n=int(input())
lfood=[]

for i in range(n):
name=input()
protien=float(input())
fat=float(input())
carb=float(input())
lfood.append(Food(name,protien,fat,carb))
status={}
cnt=int(input())
for i in range(cnt):
st=input()
l=[]
l.append(int(input()))
l.append(int(input()))
status[st]=tuple(l)
checkenergy=int(input())
obj=Nutrition(status,lfood)
result=obj.setEnergy()
ans=obj.getEnergyRichFood(checkenergy)
if(result!=None):
print("Energy of Food:")
for i in result:
print(i)
if(ans!=None):
print("Food within given criteria:")
for i in ans:
print(i)
else:
print("No Food Found")

Food code

python


Telegram- https://t.me/Allcodingsolution
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Scanner;

public class Solution {

public static void main(String[] args){
Scanner sc = new Scanner(System.in);
List<Mobile> list = new ArrayList<>();
for(int i=0;i<4;i++){

String mobileId = sc.nextLine();
String modelName = sc.nextLine();
String price = sc.nextLine();
String brand = sc.nextLine();

Mobile mobile = new Mobile(Integer.parseInt(mobileId),Integer.parseInt(price),modelName,brand);
mobile.setMobileId(Integer.parseInt(mobileId));
mobile.setPrice(Integer.parseInt(price));
mobile.setModelName(modelName);
mobile.setBrand(brand);

list.add(mobile);
}

String brand = sc.nextLine();

int ans = countMobilesByBrand(list,brand);
if(ans == 0){
System.out.println("No such mobile found.");
}
else {
System.out.println(ans);
}

Mobile ans1 =getSecondHighestPricedMobile(list);
if(Objects.isNull(ans1)){
System.out.println("No such mobile found.");
}else{
System.out.println(ans1.getModelName());
System.out.println(ans1.getPrice());
System.out.println(ans1.getBrand());
}

}

public static class Mobile {
private int mobileId;
private String modelName;
private int price;
private String brand;

public Mobile(int mobileId, int price, String modelName, String brand) {
this.mobileId = mobileId;
this.price = price;
this.modelName = modelName;
this.brand = brand;
}

public int getMobileId() {
return mobileId;
}

public void setMobileId(int mobileId) {
this.mobileId = mobileId;
}

public int getPrice() {
return price;
}

public void setPrice(int price) {
this.price = price;
}

public String getModelName() {
return modelName;
}

public void setModelName(String modelName) {
this.modelName = modelName;
}

public String getBrand() {
return brand;
}

public void setBrand(String brand) {
this.brand = brand;
}



}
private static int countMobilesByBrand(List<Mobile> list, String brand) {
int count = 0;
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getBrand().equals(brand))
count++;
}
return count;
}

private static Mobile getSecondHighestPricedMobile(List<Mobile>list){
int max = -1;
int ans =-1;
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getPrice()%2 ==0)
continue;
if(max == -1) {
max = list.get(i).getPrice();
continue;
}

int value = list.get(i).getPrice();
if(value > max){
ans = max;
max = value;
continue;
}
if(value>ans){
ans = value;
}
}
if(ans == -1)
return null;
for(int i = 0; i < list.size(); i++){
if(ans == list.get(i).getPrice())
return list.get(i);
}
return null;
}

}

Mobile. Code java

Telegram :- https://t.me/Allcodingsolution
👍1
Python Unix Code

Telegram :- https://t.me/Allcodingsolution
Java code
One test cases passes

Telegram :- https://t.me/Allcodingsolution
Infytq
Maximu of 4 unique upper case alphabets

💯% test cases passed


@Allcodingsolution
@Allcodingsolution
@Allcodingsolution
👍1
Infytq
Maximu of 4 unique upper case alphabets

💯% test cases passed

@Allcodingsolution
@Allcodingsolution
@Allcodingsolution