Skip to content
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
Binary file added Parmanand saraswat/Data Science/assignment1.docx
Binary file not shown.
38 changes: 38 additions & 0 deletions Parmanand saraswat/Late night task.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Python Late-Night Task

1. Make a script to send �Hi� 5 times to a friend.
Sol.
import webbrowser as web
import pyautogui as pg
import time
count = 0
number=int(input("Enter the number with country code as prefix: "))
while count<5:
web.open('https://web.whatsapp.com/send?phone='+str(number)+'&text=Hi')
time.sleep(30)
pg.press('enter')
time.sleep(3)
pg.hotkey('ctrl','w')
count += 1

2. Make a script to send same message to 6 persons
Sol.
import webbrowser as web
import pyautogui as pg
import time
numbers = []
count=0
while count<6:
num=input("Enter "+str(count)+" numbers to send message to: ")
numbers.append(num)
count+=1
count=1
url1 = 'https://web.whatsapp.com/send?phone='
url2 = ',&text=Hi'
for i in numbers:
web.open(url1+i+url2+' You are '+str(count)+' person')
time.sleep(15)
count+=1
pg.press('enter')
time.sleep(3)
pg.hotkey('ctrl','w')
17 changes: 17 additions & 0 deletions Parmanand saraswat/Linux/assignment1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1) When we create a user, some hidden files are generated in the directory of the same user at that time. How is it done ?

Ans. It is done because these files are in the folder /etc/skel and whichever files we place in this folder those files will be
made available in the home directory of all the users which we create afterwards.
For reference following are some commands to create a file in /etc/skel and creating and listing files in /home/user
files
-> cd /etc/root
-> touch TestFile
-> useradd RedhatUser
-> ls /home/RedhatUser
Now you'll find the TestFile document in this folder which is the proof that whichever files we put in the folder
/etc/skel will be available to all the users created after it.


2) Make sub directories inside a parent directory by using single mkdir command.

Ans. mkdir -p A/B/C (-p for parent directoy option).
23 changes: 23 additions & 0 deletions Parmanand saraswat/Linux/assignment2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Ans 1 Go to vim /etc/bashrc
Go to line no 73 in RHEL 7
OR
You can go to /etc/profile and go to line no 62
Change the umask value whichever you want
Save and exit file with :wq.

Ans 2 Add an entry for the user in /etc/passwd file.
Add an entry for the group in /etc/group file.
Create the home directory for the added user.
Set the new user password using the passwd command.

Ans 3 No, we cannot change the umask value to 0888 because if we use it then by default permission for
file and directory go to negative or less than zero that is not possible.

Ans 4 # useradd -u 1345 username.
To check unique id of that user :
Go to vim /etc/passwd

Ans 5 #chgrp groupname file/directory
5(a) To check the groupname of files inside folder
#ll file/folder
5(b) #chown -R :groupname ParentDirectory (-R for Recursively)
7 changes: 7 additions & 0 deletions Parmanand saraswat/Linux/assignment3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Ans 1 #tar -cvzf ContentFile.tar.bz2 content.txt.

Ans 2 #bzip2 -d filename.bz2 (-d specifies Decompress).

Ans 3 #cat < file.

Ans 4 #useradd -s /bin/sh username.
30 changes: 30 additions & 0 deletions Parmanand saraswat/python/Assignment1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Q1. What is Jpython and Cpython?
ANS:- Cpython is standard implementation of Python which is written in C.We call it Cpython to distinguish Python implementation
of the language engine from Python programming language itself.It is ends up producing bytecode(machine instruction set)
which is Python specific and then executes it.The reason to convert Python code to a bytecode because it's easier to
imolement an interpreter if it is looks like machine instructions.
Jpython is the other implementation of Python which is implemented for Java. Jpython is used to converts Python code
in Java bytecode so it can be implemented in JVM. JVM is used to converts Java code in machine language and executes it.

Q2. What is difference between Python2 and Python3?
ANS:- PYTHON 2 PYTHON 3
1. In Python2, print statement is used to print 1. In python3, print function is used to print any
data. data.
Ex:- print "hello" Ex:- print("hello")
2. In this version of Python xrange() function 2. range() function is used for iterations.
is uses for iterations.
3. Default storing of string is ASCII code. To 3. Default storing of string is unicode.
store Unicode string value, you require to
define them with "u".
4. Exceptions should be enclosed in notations. 4. Exceptions should be enclosed in parenthesis.
5. Value of global value can be changed while 5. Value of variable snever changed.
using it inside for loop.
6. Whenever two integer are divided, you get a 6. Whenever two integer are divided, you get a float value.
int value.

Q3. What is difference between unicode and ASCII code?
ANS:-ASCII Extended solves the problem for languages that are based on the Latin alphabet.
ASCII defines 128 characters, which map to the numbers 0�127.
Unicode sis used to solve the problem for all type of languages.Unicode is superst of ASCII code.
And the numbers 0�127 have the same meaning in ASCII as they have in Unicode. For example, the number
65 means "Latin capital 'A'".
132 changes: 132 additions & 0 deletions Parmanand saraswat/python/Assignment2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
Q1. What should be the output? ( 3 + 4 ** 6 - 9 * 10 / 2 )
ANS:- we know the precence order for arithmetic operators (*,/,+,-)
output = 4054.0

Q2. Let say I have, some string "hello this side regex"
Find out the count of the total vowels
? vowels - ['a','e','i','o','u']
ANS:-
string="hello this side regex"
vowels = ['a','e','i','o','u']
count=0
l=list()
for i in string.replace(" ",""):
l.append(i)
for k in l:
if k in vowels:
count+=1
print(count)

OUTPUT:- 7

Q3. Find out the area of triangle
- 1/2 * b * h (formula of area)
- You have to take value from user about the base, & the height
ANS:- b,h=input("enter value of base and height").split()
print(1/2*int(b)*int(h))

OUTPUT:-enter value of length and height5 6
15.0

Q4. Print the calendar on the terminal. If you give the year.
- Allow the user to input the year.
- Then should that calendar of that year
ANS:- import calendar
year=int(input("enter a year"))
for i in range(1,13):
print(calendar.month(year,i))
OUTPUT:- January 2021
Mo Tu We Th Fr Sa Su
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

February 2021
Mo Tu We Th Fr Sa Su
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

March 2021
Mo Tu We Th Fr Sa Su
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

April 2021
Mo Tu We Th Fr Sa Su
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

May 2021
Mo Tu We Th Fr Sa Su
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

June 2021
Mo Tu We Th Fr Sa Su
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

July 2021
Mo Tu We Th Fr Sa Su
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

August 2021
Mo Tu We Th Fr Sa Su
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

September 2021
Mo Tu We Th Fr Sa Su
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

October 2021
Mo Tu We Th Fr Sa Su
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

November 2021
Mo Tu We Th Fr Sa Su
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

December 2021
Mo Tu We Th Fr Sa Su
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
46 changes: 46 additions & 0 deletions Parmanand saraswat/python/Assignment3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Q1. Find the Armstrong Number between the two numbers which are input by user
? Armstrong number : 153 -> 1*1*1 + 5*5*5 + 3*3*3
ANS:-m=int(input("enter number1 :"))
n=int(input("enter number2 :"))
for num in range(m,n+1):
sum=0
temp=num
while temp>0:
rem=temp%10
sum+=rem**3
temp=temp/10
if num==sum:
print(num)
else:
continue

OUTPUT:-enter number1 :151
enter number2 :154
153

Q2. Let�s say you have a string �hello this world @2020!!! �
? Remove the punctuation like [�@!#$%&*()�] from the string
� Final output should be without the punctuation
? �hello this world 2020�
ANS:- string=input("enter your string :")
for i in string:
if i.isalnum() or i==' ':
print(i,end="")

OUTPUT:-enter your string :hello this world @2020!!!
hello this world 2020

Q3. You have a list with words - [�Apple�, �banana�, �cat�, �REGEX�,�apple�]
? Sort words in Alphabetical order
� If you get output, like [Apple, apple, banana]
? How has it happened?
ANS:-
l=["Apple", "banana", "cat", "REGEX","apple"]
print(sorted(l)) #we also can use here l.sort() and then print(l)

OUTPUT:- ['Apple', 'REGEX', 'apple', 'banana', 'cat']

REASON:-- Python put uppercase items first because the ASCII value(Python2) or unicode(Python3) value for
uppercase items is less than lowercase items. And hence if we sort them in increasing order, the
upper case will come before the lower case.

Loading