Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
72dac64
Add files via upload
Tanya581 Apr 9, 2020
2ed5134
submitting till assignment 3
Tanya581 Apr 11, 2020
089be25
Completed python assignment
Tanya581 Apr 11, 2020
aabc13e
Add files via upload
Tanya581 Apr 12, 2020
b238749
Assignments
Tanya581 Apr 14, 2020
59f9fee
python assignment3
Tanya581 Apr 14, 2020
5403ed2
Assignments(tanya)
Tanya581 Apr 15, 2020
c7e7d55
Delete python assignment.txt
Tanya581 Apr 15, 2020
7e18ce8
Delete python assignment 2-checkpoint.ipynb
Tanya581 Apr 15, 2020
e1ea5f7
Delete assignment3.txt
Tanya581 Apr 15, 2020
b80c106
Delete leftover assignment.txt
Tanya581 Apr 15, 2020
cb7462f
Delete assignment.txt
Tanya581 Apr 15, 2020
95cad06
Delete assignment.txt
Tanya581 Apr 15, 2020
095d46e
Delete Untitled-checkpoint.ipynb
Tanya581 Apr 15, 2020
d7867c0
Delete assignment.txt
Tanya581 Apr 15, 2020
d7e94cf
Delete assignment3.txt
Tanya581 Apr 15, 2020
8018015
Delete leftover assignment.txt
Tanya581 Apr 15, 2020
ab54b43
Delete python assignment 2.ipynb
Tanya581 Apr 15, 2020
3c89ef8
Delete python assignment.txt
Tanya581 Apr 15, 2020
279e151
Delete assignment3.txt
Tanya581 Apr 15, 2020
da101c8
Delete leftover assignment.txt
Tanya581 Apr 15, 2020
7e2cecd
Delete python assignment 2.ipynb
Tanya581 Apr 15, 2020
b1bc955
Delete python assignment.txt
Tanya581 Apr 15, 2020
3442d38
Add files via upload
Tanya581 Apr 15, 2020
7ef8d1f
python assignment 4
Tanya581 Apr 18, 2020
87cc4ce
Add files via upload
Tanya581 Apr 25, 2020
ae806b8
Delete linux assignment 1 and 2.txt
Tanya581 Apr 25, 2020
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
3,315 changes: 3,315 additions & 0 deletions Tanya Sharma/CoronaCases.csv

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions Tanya Sharma/linux assignment 1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
1. When we add a new user using command useradd why the folder is not created inside the home directory?
Ans. useradd is a low level utility for adding users so it doesnot show the folder.

2. 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. Hidden file is a folder or file which filesystem utilities do not display by default when showing a directory listing.
They are commonly used for storing user preferences or preserving the state of a utility, and are frequently created implicitly
by using various utilities. They are not a security mechanism because access is not restricted usually the intent is simply to not
clutter the display of the contents of a directory listing with files the user did not directly create.

3. Make sub directories inside a parent directory by using single mkdir command.
Ans. mkdir -p A/{B,C,D,E}

The -p flag tells the mkdir command to create the main directory first if it doesn�t already exist (A, in our case).
The words in the brackets are the subdirectories to be created. Each of the items in the brace expansion list
is appended separately to the preceding path A.

4. Change the Umask value for any user permanently.
Ans. To change the default Umask value to anything, write a
new Umask value in your shell�s configuration file (~/.bashrc for Bash) or in the /etc/profile file.

5. How to add a new user with a Unique user id (e.g 1345) & check out the unique Id of that user.

Ans. Use the -u (--uid) option to create a user with a specific UID.
For example to create a new user named username with UID of 1500 you would type:


sudo useradd -u 1345 username

You can verify the user�s UID, using the id command:


id -u username
1345


6. Tac vs Cat command
Ans Cat command is a well known Unix utility that reads files sequentially.
Writing them to conventional output. The name is derived from its function for concatenating and listing the documents.
Tac (that is �cat� backwards) concatenates every record to traditional output much like the cat command.
However in opposite line-by means of-line, printing the last line first.

The basic example of cat command:-
1. $ cat text.txt
The above command is to read files and display them.
2. $ cat text.txt text2.txt>text3.txt
This command can also be used to concatenate (join) multiple files into one single file using the �>�
3. The cat command is also used to copy the content from one file to an other new file.

The basic example of tac command:-
1.$ tac text3.txt

7. How to add user without using adduser or useradd command?
Ans Step1 :Add an entry for the user in /etc/passwd file.
Step2: Add an entry for the group in /etc/group file.
Step3: Create the home directory for the added user.
Step4: Set the new user password using the passwd command.

8. How to change the group of any folder ?
Ans to change the group of any folder we use *chgrp command*.


9. How to change the group of files and the folder with a single command?
Ans. Using the chgrp command
chgrp [OPTIONS] GROUP FILE..


GROUP, name of the new group

FILE... name of one or more files.

10. Create a new user and at the same time you have to add that user into the group you already have?
Ans. useradd -G groupname username

17 changes: 17 additions & 0 deletions Tanya Sharma/linux assignment3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1. create,compress and unzip the file with bzip2.
Ans Creating a file
#yes "R" >> regex.txt
ctrl+c
Compressing the file
#bzip2 regex.txt
Decompressing the file
#bzip2 -d regex.txt.bz2

2. Read a file and show the data on terminal using file input output redirection.
Ans File input output redirection symbol is >.
-> to see the output
cat < date1.txt

3. How to change the shell of user to "/bin/sh" at the time of adding the user?
Ans To change the shell we use chsh command
chsh -s /bin/bash
25 changes: 25 additions & 0 deletions Tanya Sharma/linux leftover assignment of 1 and 2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
1. Tac vs Cat command
Ans Cat command is a well known Unix utility that reads files sequentially.
Writing them to conventional output. The name is derived from its function for concatenating and listing the documents.
Tac (that is �cat� backwards) concatenates every record to traditional output much like the cat command.
However in opposite line-by means of-line, printing the last line first.

The basic example of cat command:-
1. $ cat text.txt
The above command is to read files and display them.
2. $ cat text.txt text2.txt>text3.txt
This command can also be used to concatenate (join) multiple files into one single file using the �>�
3. The cat command is also used to copy the content from one file to an other new file.

The basic example of tac command:-
1.$ tac text3.txt

2. How to add user without using adduser or useradd command?
Ans Step1 :Add an entry for the user in /etc/passwd file.
Step2: Add an entry for the group in /etc/group file.
Step3: Create the home directory for the added user.
Step4: Set the new user password using the passwd command.

3. How to change the group of any folder ?
Ans to change the group of any folder we use *chgrp command*.

45 changes: 45 additions & 0 deletions Tanya Sharma/python assignment 1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
1. What are the different types of python compilers? what is Jpython and Cpython?
Ans. Different types of Python Compilers:

1)CPython.

2)Jython or Jpython.

3)IronPython.

4)ActivePython.

5)PyJS (it also is formerly known as Pyjamas).

6)Nuitka.

7)Stackless Python.

CPython
It is the most widely used interpreter in Python, developed in C and python,
the bindings for the interpreter must be written in a foreign language other than Python.
CPython uses a Global Interpreter Lock (GIL) on each process thus python bytecode for
a single process is executed on a single thread.CPython finds its use as many libraries are C optimized
i.e. many libraries will run its processes faster in a C based code.
The steps of compilation are as follows:- Decoding, Tokenizing, Parsing, AST(Abstract Syntax Tree), Compiling.

Jython or Jpython
Jython is an implementation that has been designed for the seamless integration of Python code over Java virtual machine,
the advantage of this integration is that it provides an opportunity for an action of a popular scripting language like python
to a vast library of the Java virtual machine. Jython compiles files to .class extensions.
The Jython programs can inherit and run any Java class and compile the code to bytecode. Along with this Jython can be
used to implement any Java-based packages especially desirable for creating solutions using Servlets, Swing, SWT,
and AWT packages.

2. Difference between python2 and python3.
Ans 1. Python2 is legacy, Python3 is the future.
2. Python2 and Python 3 have different(sometimes incompatible) libraries.
3.There is better unicode support in Python3.
4.Python3 has improved integer version.
5.They have different print syntax statement.

3. Difference between ASCII and unicode.
Ans 1.ASCII uses an 8-bit encoding while Unicode uses a variable bit encoding.
2.Unicode is standardized while ASCII isn�t.
3.Unicode represents most written languages in the world while ASCII does not.
4.ASCII has its equivalent within Unicode
191 changes: 191 additions & 0 deletions Tanya Sharma/python assignment 2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# What should be the output? ( 3 + 4 ** 6 - 9 * 10 / 2 )"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4054.0\n"
]
}
],
"source": [
"a=( 3 + 4 ** 6 - 9 * 10 / 2 )\n",
"print(a)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Let say I have, some string \"hello this side regex\".Find out the count of the total vowels"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Total number of vowels: 7\n"
]
}
],
"source": [
"vowel=['a','e','i','o','u']\n",
"str=\"hello this side regex\"\n",
"count = 0\n",
"for alphabet in str: \n",
" if alphabet in vowel: \n",
" count = count + 1\n",
"print(\"Total number of vowels: \",count) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Find out the area of triangle, where you have to take value from user about the base, & the height"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"enter the base of the triangle: 5\n",
"enter the height of the triangle: 6\n",
"15.0\n"
]
}
],
"source": [
"b=float(input(\"enter the base of the triangle: \"))\n",
"h=float(input(\"enter the height of the triangle: \"))\n",
"area=(1/2)*b*h\n",
"print(area)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Print the calendar on the terminal.Allow the user to input the year."
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Enter Year: 1998\n",
" 1998\n",
"\n",
" January February March\n",
"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n",
" 1 2 3 4 1 1\n",
" 5 6 7 8 9 10 11 2 3 4 5 6 7 8 2 3 4 5 6 7 8\n",
"12 13 14 15 16 17 18 9 10 11 12 13 14 15 9 10 11 12 13 14 15\n",
"19 20 21 22 23 24 25 16 17 18 19 20 21 22 16 17 18 19 20 21 22\n",
"26 27 28 29 30 31 23 24 25 26 27 28 23 24 25 26 27 28 29\n",
" 30 31\n",
"\n",
" April May June\n",
"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n",
" 1 2 3 4 5 1 2 3 1 2 3 4 5 6 7\n",
" 6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14\n",
"13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21\n",
"20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28\n",
"27 28 29 30 25 26 27 28 29 30 31 29 30\n",
"\n",
" July August September\n",
"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n",
" 1 2 3 4 5 1 2 1 2 3 4 5 6\n",
" 6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13\n",
"13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20\n",
"20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27\n",
"27 28 29 30 31 24 25 26 27 28 29 30 28 29 30\n",
" 31\n",
"\n",
" October November December\n",
"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n",
" 1 2 3 4 1 1 2 3 4 5 6\n",
" 5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13\n",
"12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20\n",
"19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27\n",
"26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31\n",
" 30\n",
"\n"
]
}
],
"source": [
"import calendar\n",
"year = int(input(\"Enter Year: \"))\n",
"#month = int(input(\"Enter Month: \"))\n",
"print(calendar.calendar(year)) "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Loading