Android practicals

Mobile Application Development Practical 33

Mobile Application Development Practical 32 Question 1 Write a program to locate user’s current location. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/Theme.Practical31" tools:targetApi="31"> <meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyAAl7T5IB74VSYRkOVs1F25Vv_EtKJKddA" /> <activity android:name=".MapsActivity" android:exported="true" android:label="@string/title_activity_maps"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> […]

Mobile Application Development Practical 33 Read More »

Programming With Python Practical 16

Programming With Python Practical 16 Question 1 Write a Python program to Check for ZeroDivisionError Exception. division.py num1=int(input("Enter a numerator: ")) num2=int(input("Enter a denominator: ")) try: result=num1/num2 print("Division is: ",result) except ZeroDivisionError: print("Denominator can not be zero") Output Question 2 Write a Python program to create user defined exception that will check whether the password

Programming With Python Practical 16 Read More »

Programming With Python Practical 15

Programming With Python Practical 15 Question 1 Create a class Employee with data members: name, department and salary. Create suitable methods for reading and printing employee information emp.py class Person: name="" def getData(self,n): self.name=n def putData(self): print("Name is: ",self.name) class Employee(Person): department="" salary=None def get(self,dep,sal): self.department=dep self.salary=sal def put(self): print("Department is: ",self.department) print("Salary is: ",

Programming With Python Practical 15 Read More »

Programming With Python Practical 13

Programming With Python Practical 13 Question 1 Write a Python program to create two matrices and perform addition, subtraction, multiplication and division operation on matrix. matrix.py import numpy as np a=np.array([]) b=np.array([]) print("Enter elements of first matrix: ") for i in range(0,4): num=int(input("Element:")) a=np.append(a,num) a.shape=(2,2) print("Enter elements of second matrix: ") for i in range(0,4):

Programming With Python Practical 13 Read More »

Programming With Python Practical 12

Programming With Python Practical 12 Question 1 Write a Python program to create a user defined module that will ask your college name and will display the name of the college. college.py def getcollege(): cname=input("Enter your college name: ") print("Your college name is: ",cname) collegemain.py import college college.getcollege() Output Question 2 Write a Python program

Programming With Python Practical 12 Read More »

Programming With Python Practical 11

Programming With Python Practical 11 Question 1 Write a Python function that takes a number as a parameter and check the number is prime or not. prime.py def primeno(num): flag=0 for i in range(2,num): if(num%i==0): flag=1 break if(flag==1): print("number is not prime") else: print("number is prime") num=int(input("Enter a number")) primeno(num) Output Question 2 Write a

Programming With Python Practical 11 Read More »

Programming With Python Practical 10

Programming With Python Practical 10 Question 1 Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters. count.py Str=input("Enter a string: ") count1=0 count2=0 for i in Str: if(i.islower()): count1+=1 else: count2+=1 print("The number of lowercase letters is: ",count1) print("The number of uppercase letters is:

Programming With Python Practical 10 Read More »

Programming With Python Practical 9

Programming With Python Practical 9 Question 1 Write a Python script to sort (ascending and descending) a dictionary by value. sort.py my_dict = { 'num1': 6, 'num2': 3, 'num3': 2, 'num4': 4, 'num5': 1, 'num6': 5} sortedVal = sorted(my_dict.values()) keys=[] print("Dictionary in ascending order by values is: ") for val in sortedVal: for k,v in

Programming With Python Practical 9 Read More »

Programming With Python Practical 8

Programming With Python Practical 8 Question 1 Write a Python program to create a set, add member(s) in a set and remove one item from set. createset.py num={10,50,60,40,20,30,80} print("Set is created as :",num) a=int(input("Enter the number to add into set :")) num.add(a) print("After adding set is :",num) b=int(input("Enter the number to remove from set :"))

Programming With Python Practical 8 Read More »