Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions PUSAPATI SWETHA/assignment1- 07.04.2020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Q1 how to change umask value permanently
write a new umask value in the shell configuration file(~/.bashrc for Bash) or in the /etc/profile file

Q2 how to add new user without adduser or useradd
add the user in /etc/passwd file then add a group with the same name in /etc/group and then set passwd with passwd command

Q3 can umask value be changed to 0888
it can not be changed to 0888 because the maximum value of a umask itself is 0777(r=4, w=2, x=1; 4+2+1=7)


Q4 how to add new user with unique id & how to check that unique id
useradd -u 1345 username //creates a new user with our desired Unique id (given here 1345)
cat /etc/passwd | grep username // prints the userd ID on the terminal

Q5 (a) how to change group of any folder
chgrp [options] group filename

(b)group name of files present in the folder
ls -ld
5 changes: 5 additions & 0 deletions PUSAPATI SWETHA/assignment2- 08.04.2020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Q) how to unzip a bz2 file
first type tar xzff filename.tar.bz2 which uncompresses a bzip2 tar file

Q) how to add a user and at the same time we must chnage shell of the user
useradd -s /bin/bash/bin/rbash <username>
5 changes: 5 additions & 0 deletions PUSAPATI SWETHA/assignment3- 10.04.2020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Q) difference between ascii and unicode
ASCII uses 7 bits to encode each character whereas unicode uses a variable bit encoding program where we can choose between 8,16, 32 bit encodings

Q) what are the python complilers
1. CPython 2.JPython 3.IronPython 4. ActivePython 5.PyJS 6. Nutika 7.Stackless Python
27 changes: 27 additions & 0 deletions PUSAPATI SWETHA/assignment4- 11.04.2020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Q) output of 3+4**6-9*10/2
4054 ( 1. 4**6=4096 2. 10/2=5 3. 9*5=45 4. 3+4096=4099 5. 4099-45=4054)
Q)string given is "hello this side is regex" count the number of vowels
str = "hello this side regex"
str1 = str.lower()
vow=0
for i in str1:
if(i=='a'or i=='e' or i=='o' or i=='i' or i=='u')
vow=vow+1
print("number of vowels are ")
print (vow)

Q) calculate area of triangle
print("enter the base of triangle")
b = int(input())
print("enter the height of triangle")
h = int(input())
area = 0.5*b*h
print("area is ")
print (area)

Q) print calendar of the year given a input
import calendar
print("enter year and then the month")
y = int(input())
m = int(input())
print(calendar.month(y,m))
32 changes: 32 additions & 0 deletions PUSAPATI SWETHA/assignment5- 12.04.2020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Q) armstrong number in a range

l = int(input("enter the lower range:"))
u = int(input("enter the upper range:"))
for num in range(lower,upper+1):
sum=0
i=num
while i >0 :
d = 1%10
sum+=d**3
i/=10
if num == sum
print(num)

Q) to remove special characters in a given string
str1 = (input("enter the string:"))
str2 = " "
for i in str1:
if i.isalnum()
str2 += i
print(str2)

Q) to sort the given list and explain the output
ls1 = ["apple", "banana", "cat", "REGEX", "Apple"]
ls1.sort()
print("sorted list")
print(ls1)

output: ["Apple", "REGEX", "apple", "banana", "cat"]
Explanation: A has the ASCII value of 65 which is the least hence appears first in the sorted output.
We then get REGEX in the output instead of apple because R has the AScCII value 82 whereas a, b, c have ASCII values 97, 98, 99 respectively.
The sort() sorts in ascending order of the ASCII values.
66 changes: 66 additions & 0 deletions PUSAPATI SWETHA/assignment6- 13.04.2020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Q) print first letter of each character of strings in the list and add it to
a new list

LIST_STATES = ["GOA","RAJASTHAN","KARNATAKA","GUJRAT","MANIPUR",
MADHYA PRADESH]
a = [ ]
for x in LIST_STATES:
a.append(x[0])

print (a)

Q)Write a program to replace each string with an integer value in a given list of strings.
The replacement integer value should be a sum of AScci values of each character of type
corresponding string........
LIST: ['GAnga', 'Tapti', 'Kaveri', 'Yamuna', 'Narmada' ]

mylist = ['GAnga', 'Tapti', 'Kaveri', 'Yamuna', 'Narmada' ]
a = [ ]
for x in mylist:
sum=0
for i in x:
sum += ord(i)
a.append(sum)
print (a)

Q)You have to run your Program at 9:00am. Date: 14th April 2020.

import time()
a = time.ctime()
b = a.split(" ")
if (b[1] == 'apr' && b[2] == 14 && b[3] == 09:00:00)
print("your program is now running)

Q)GIve a tuple:
tuple = ('a','l','g','o','r','i','t','h','m')
1. Using the concept of slicing, print the whole tuple
2. delete the element at the 3rd Index, print the tuple.

tupple1 = ('a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm')
x = slice(0,9)
print(a[x])

tupple1 = ('a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm')
y = list(tupple)
y[2] = " "
tupple1 = tuple(y)

print(tupple1)

Q)Take a list REGex=[1,2,3,4,5,6,7,8,9,0,77,44,15,33,65,89,12]
- print only those numbers greator then 20
- then print those numbers those are less then 10 or equal to 10
- store these above two list in two different list.

REGex = [1,2,3,4,5,6,7,8,9,0,77,44,15,33,65,89,12]
list1 = [ ]
list2 = [ ]
for i in REGex:
if i>20:
print (i)
list1.append(i)
for j in REGex:
if j>=10:
print(j)
list2.append(j)

54 changes: 54 additions & 0 deletions PUSAPATI SWETHA/assignment7- 14.04.2020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Q)Output Should be :
Loading.
Loading..
Loading...
Loading....
Loading.....
Here it shows you 5 output but you have to print only "Loading....." in animated
form.

import time
i = 0
for i in range(5)
time.sleep(2)
print("loading..")

Q) Difference between Return and Yield ?

return: * it sends a specified value back to its caller
* causes a function to exit
* terminates the execution of a function & destroys local variables

yield: * used to define generators
* replaces the return value of a function to suspend its execution without
destroying the local variables
* used when the generator returns an intermediate result to caller

Q)Add anything in tuple.. example: (1,2,3,4) -> new tuple (1,2,3,4,5)

x = (1,2,3,4)
y = list(x)
y[4] = 5
x = tuple(y)
print(x)

Q)WhatsApp texting using webbrowser Lib.

import webbrowser
webbrowser.open_new_tab("https://web.whatsapp.com/")

Q)Make digital Clock and run it for 5 sec.
Output:
16:39:08
:09
:10
:11
:12

import time

for i in range(5)
a = str(time.ctime())
b = a.split(" ")
print(b[3])
time.sleep(1)
59 changes: 59 additions & 0 deletions PUSAPATI SWETHA/assignment8- 16.04.2020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Q)Write a Python program to read a file line by line and store it into a list.
def readfile(fname):
with open(fname) as f:
list = f.readlines()
print(list)
readfile('test.txt')

Q)Write a Python program to read a file line by line store it into an array.
def readfile(fname):
array = []
with open(fname) as f:
for line in f:
array.append(line)
print(array)

readfile('test.txt')

Q)Write a Python program to read a random line from a file.
import random
def random_line(fname):
lines = open(fname).read().splitlines()
return random.choice(lines)
print(random_line('test.txt'))

Q)Write a Python program to combine each line from first file with the
corresponding line in second file
with open('abc.txt') as fh1, open('test.txt') as fh2:
for line1, line2 in zip(fh1, fh2):
print(line1+line2)

Q)Write a Python program to generate 26 text files named A.txt, B.txt, and
so on up to Z.txt.
import string, os
if not os.path.exists("letters"):
os.makedirs("letters")
for letter in string.ascii_uppercase:
with open(letter + ".txt", "w") as f:
f.writelines(letter)

Q)Write a Python program to create a file where all letters of English
alphabet are listed by specified number of letters on each line.
import string
def letters_file_line(n):
with open("words1.txt", "w") as f:
alphabet = string.ascii_uppercase
letters = [alphabet[i:i + n] + "\n" for i in range(0, len(alphabet), n)]
f.writelines(letters)
letters_file_line(3)

Q)webscraping
import requests
from bs4 import BeautifulSoup
url = "https://www.worldometers.info/coronavirus/"
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
b = soup.find("div", {"class":"maincounter-number"})
c = soup.findAll("h1")
for i in c:
print(i.text)
18 changes: 18 additions & 0 deletions PUSAPATI SWETHA/aws assignment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
1. What if the .pem key file or the .ppk key file to our ec2 machine is lost?
In the cases where the private key file having the RSA is lost, unfortunately there is no wat to get back the key file but there surely is a way to get our instance back.
To do so we need to perform some tasks listed below:

Create an Image of the ec2 instance:

1. Select the instance from EC2 Dashboard
2. Under the Actions tab goto image and click Image
3. Enter an appropriate image name and image description and Create Image.
4. After doing this a request to generate image has successfully been placed on the AWS account. To check the status of image one can go to AMI’s section under IMAGES from the right navigation pane.
5. After the image has been created you can launch the new instance using that Image from AMI section or from EC2 Launch Wizard.
6. If you launch from EC2 launch wizard be sure you choose the Image that you created, it would be available under “My AMIs” section.
7. And do not forget to create a new key pair while launching it.
8. Select the image and launch the instance. A new instance with all the data of the old instance is now ready to use.
9. The image created can also be further migrated to any other AWS account (not AWS Educate accounts).



29 changes: 29 additions & 0 deletions PUSAPATI SWETHA/big data assignment.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Q)differences between hadoop1 and hadoop2.

hadoop1:* it has map reduce
*it has job tracker and task tracker
*In Hadoop 1, there is HDFS which is used for storage and top of it,
Map Reduce which works as Resource Management as well as Data Processing.
Due to this workload on Map Reduce, it will affect the performance
*Hadoop 1 is a Master-Slave architecture. It consists of a single master and multiple slaves.
Suppose if master node got crashed then irrespective of your best slave nodes, your cluster will be destroyed.
Again for creating that cluster means copying system files, image files, etc. on another system is too much time consuming which will not be tolerated by organizations in today’s time.


hadoop2:*it has YARN
*it has resource manager and node manager
*In Hadoop 2, there is again HDFS which is again used for storage and on the top of HDFS, there is YARN which works as Resource Management.
It basically allocates the resources and keeps all the things going on.
*Hadoop 2 is also a Master-Slave architecture. But this consists of multiple masters (i.e active namenodes and standby namenodes) and multiple slaves.
If here master node got crashed then standby master node will take over it. You can make multiple combinations of active-standby nodes.
Thus Hadoop 2 will eliminate the problem of a single point of failure.


Q) why hadoop has block of 128 mb

minimize the cost of seek and reduce the meta data information generated per block.


Q)why does name node rely on memory
The namenode keeps all of the filesystem layout information (files, blocks, directories, permissions, etc) and the block locations.
The filesystem layout is persisted on disk and the block locations are kept solely in memory
25 changes: 25 additions & 0 deletions PUSAPATI SWETHA/whatsapp python.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import requests as rq
import pyautogui as pg
import webbrowser as wb
num=[]
message=input("Enter your message: ")
count=int(input("How many person you want to send message: "))
Message=int(input("How many message you want to send: "))
for i in range(count):
n=int(input("Enter Contact Number followed by 91: "))
num.append(num)
for a in range(count):
time.sleep(2)
link="https://web.whatsapp.com/send?phone={}&text={}".format(number[a],message)
wb.open(link)
time.sleep(15)
print("Page timeout")
pg.press("enter")
for x in range(Message):
pg.typewrite(message)
pg.press("enter")
time.sleep(2)
pg.hotkey("ctrl","w")
pg.press("enter")
print("Mesage sent to {} message is {}".format(number[a],message))
print("message sent")