From 72dac6476aee0779c8f219f4260a5a4f06247a82 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Thu, 9 Apr 2020 15:37:30 +0530 Subject: [PATCH 01/27] Add files via upload i have left 3 questions which i will upload later as i was not able to find the solutions for that. --- Regex/assignment.txt | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Regex/assignment.txt diff --git a/Regex/assignment.txt b/Regex/assignment.txt new file mode 100644 index 0000000..fd69c13 --- /dev/null +++ b/Regex/assignment.txt @@ -0,0 +1,47 @@ +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 doesnt 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 shells 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 users UID, using the id command: + + + id -u username + 1345 + +6. 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. + +7. 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 + From 2ed51348c9453dbff5c66b58c9c9faf9374ab815 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Sat, 11 Apr 2020 16:07:13 +0530 Subject: [PATCH 02/27] submitting till assignment 3 --- regex2/assignment3.txt | 17 +++++++++++++++++ regex2/leftover assignment.txt | 25 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 regex2/assignment3.txt create mode 100644 regex2/leftover assignment.txt diff --git a/regex2/assignment3.txt b/regex2/assignment3.txt new file mode 100644 index 0000000..5454636 --- /dev/null +++ b/regex2/assignment3.txt @@ -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 \ No newline at end of file diff --git a/regex2/leftover assignment.txt b/regex2/leftover assignment.txt new file mode 100644 index 0000000..8986b85 --- /dev/null +++ b/regex2/leftover assignment.txt @@ -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*. + \ No newline at end of file From 089be2584606375d728ffd62fcb0714907ba772b Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Sat, 11 Apr 2020 16:44:39 +0530 Subject: [PATCH 03/27] Completed python assignment --- python assignment.txt | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 python assignment.txt diff --git a/python assignment.txt b/python assignment.txt new file mode 100644 index 0000000..b9d410c --- /dev/null +++ b/python assignment.txt @@ -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 isnt. + 3.Unicode represents most written languages in the world while ASCII does not. + 4.ASCII has its equivalent within Unicode \ No newline at end of file From aabc13e9fc0c46453cb958d5d0a3cfe9e5e7f06e Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Sun, 12 Apr 2020 18:24:56 +0530 Subject: [PATCH 04/27] Add files via upload --- python assignment 2-checkpoint.ipynb | 191 +++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 python assignment 2-checkpoint.ipynb diff --git a/python assignment 2-checkpoint.ipynb b/python assignment 2-checkpoint.ipynb new file mode 100644 index 0000000..b78e871 --- /dev/null +++ b/python assignment 2-checkpoint.ipynb @@ -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 +} From b2387495e17918b8bd3aa5923d95b94842edf4c5 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Tue, 14 Apr 2020 12:40:53 +0530 Subject: [PATCH 05/27] Assignments --- Tanya Sharma/assignment.txt | 47 ++++++ Tanya Sharma/assignment3.txt | 17 +++ Tanya Sharma/leftover assignment.txt | 25 ++++ Tanya Sharma/python assignment 2.ipynb | 191 +++++++++++++++++++++++++ Tanya Sharma/python assignment.txt | 45 ++++++ 5 files changed, 325 insertions(+) create mode 100644 Tanya Sharma/assignment.txt create mode 100644 Tanya Sharma/assignment3.txt create mode 100644 Tanya Sharma/leftover assignment.txt create mode 100644 Tanya Sharma/python assignment 2.ipynb create mode 100644 Tanya Sharma/python assignment.txt diff --git a/Tanya Sharma/assignment.txt b/Tanya Sharma/assignment.txt new file mode 100644 index 0000000..fd69c13 --- /dev/null +++ b/Tanya Sharma/assignment.txt @@ -0,0 +1,47 @@ +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 doesnt 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 shells 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 users UID, using the id command: + + + id -u username + 1345 + +6. 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. + +7. 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 + diff --git a/Tanya Sharma/assignment3.txt b/Tanya Sharma/assignment3.txt new file mode 100644 index 0000000..5454636 --- /dev/null +++ b/Tanya Sharma/assignment3.txt @@ -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 \ No newline at end of file diff --git a/Tanya Sharma/leftover assignment.txt b/Tanya Sharma/leftover assignment.txt new file mode 100644 index 0000000..8986b85 --- /dev/null +++ b/Tanya Sharma/leftover assignment.txt @@ -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*. + \ No newline at end of file diff --git a/Tanya Sharma/python assignment 2.ipynb b/Tanya Sharma/python assignment 2.ipynb new file mode 100644 index 0000000..b78e871 --- /dev/null +++ b/Tanya Sharma/python assignment 2.ipynb @@ -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 +} diff --git a/Tanya Sharma/python assignment.txt b/Tanya Sharma/python assignment.txt new file mode 100644 index 0000000..b9d410c --- /dev/null +++ b/Tanya Sharma/python assignment.txt @@ -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 isnt. + 3.Unicode represents most written languages in the world while ASCII does not. + 4.ASCII has its equivalent within Unicode \ No newline at end of file From 59f9fee2627be0d3bf34cbf07625351441f7b60e Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Tue, 14 Apr 2020 17:25:50 +0530 Subject: [PATCH 06/27] python assignment3 --- .../Tanya Sharma/Untitled-checkpoint.ipynb | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Tanya Sharma/Tanya Sharma/Untitled-checkpoint.ipynb diff --git a/Tanya Sharma/Tanya Sharma/Untitled-checkpoint.ipynb b/Tanya Sharma/Tanya Sharma/Untitled-checkpoint.ipynb new file mode 100644 index 0000000..5cb34a8 --- /dev/null +++ b/Tanya Sharma/Tanya Sharma/Untitled-checkpoint.ipynb @@ -0,0 +1,139 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Find the Armstrong Number between the two numbers which are input by user" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter first number: 100\n", + "Enter second number: 500\n", + "153\n", + "370\n", + "371\n", + "407\n" + ] + } + ], + "source": [ + "first = int(input(\"Enter first number: \"))\n", + "second = int(input(\"Enter second number: \"))\n", + " \n", + "for num in range(first,second + 1):\n", + " sum = 0\n", + " temp = num\n", + " while temp > 0:\n", + " digit = temp % 10\n", + " sum += digit ** 3\n", + " temp //= 10\n", + " if num == sum:\n", + " print(num)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Remove the punctuation like [“@!#%&*()”] from the string" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello this world 2020\n" + ] + } + ], + "source": [ + "punctuations = '“@!#$%&*()”'\n", + "\n", + "my_str = \"hello this world @2020!!!\"\n", + "\n", + "no_punct = \"\"\n", + "for char in my_str:\n", + " if char not in punctuations:\n", + " no_punct = no_punct + char\n", + "print(no_punct)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Sort words in Alphabetical order" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Apple', 'banana', 'cat', 'REGEX', 'apple']\n" + ] + } + ], + "source": [ + "lst = [\"Apple\", \"banana\", \"cat\", \"REGEX\",\"apple\"]\n", + "sorted(lst) \n", + "print(lst) \n" + ] + }, + { + "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 +} From 5403ed279c13fd6916b7cbfd3d9709050b9d7ba6 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 14:47:56 +0530 Subject: [PATCH 07/27] Assignments(tanya) --- Tanya Sharma/Tanya Sharma/assignment.txt | 47 +++++ Tanya Sharma/Tanya Sharma/assignment3.txt | 17 ++ .../Tanya Sharma/leftover assignment.txt | 25 +++ .../Tanya Sharma/python assignment 2.ipynb | 191 ++++++++++++++++++ .../Tanya Sharma/python assignment.txt | 45 +++++ 5 files changed, 325 insertions(+) create mode 100644 Tanya Sharma/Tanya Sharma/assignment.txt create mode 100644 Tanya Sharma/Tanya Sharma/assignment3.txt create mode 100644 Tanya Sharma/Tanya Sharma/leftover assignment.txt create mode 100644 Tanya Sharma/Tanya Sharma/python assignment 2.ipynb create mode 100644 Tanya Sharma/Tanya Sharma/python assignment.txt diff --git a/Tanya Sharma/Tanya Sharma/assignment.txt b/Tanya Sharma/Tanya Sharma/assignment.txt new file mode 100644 index 0000000..fd69c13 --- /dev/null +++ b/Tanya Sharma/Tanya Sharma/assignment.txt @@ -0,0 +1,47 @@ +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 doesnt 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 shells 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 users UID, using the id command: + + + id -u username + 1345 + +6. 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. + +7. 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 + diff --git a/Tanya Sharma/Tanya Sharma/assignment3.txt b/Tanya Sharma/Tanya Sharma/assignment3.txt new file mode 100644 index 0000000..5454636 --- /dev/null +++ b/Tanya Sharma/Tanya Sharma/assignment3.txt @@ -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 \ No newline at end of file diff --git a/Tanya Sharma/Tanya Sharma/leftover assignment.txt b/Tanya Sharma/Tanya Sharma/leftover assignment.txt new file mode 100644 index 0000000..8986b85 --- /dev/null +++ b/Tanya Sharma/Tanya Sharma/leftover assignment.txt @@ -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*. + \ No newline at end of file diff --git a/Tanya Sharma/Tanya Sharma/python assignment 2.ipynb b/Tanya Sharma/Tanya Sharma/python assignment 2.ipynb new file mode 100644 index 0000000..b78e871 --- /dev/null +++ b/Tanya Sharma/Tanya Sharma/python assignment 2.ipynb @@ -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 +} diff --git a/Tanya Sharma/Tanya Sharma/python assignment.txt b/Tanya Sharma/Tanya Sharma/python assignment.txt new file mode 100644 index 0000000..b9d410c --- /dev/null +++ b/Tanya Sharma/Tanya Sharma/python assignment.txt @@ -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 isnt. + 3.Unicode represents most written languages in the world while ASCII does not. + 4.ASCII has its equivalent within Unicode \ No newline at end of file From c7e7d550e049975304a845852d3b7b4604fbdbb2 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:31:13 +0530 Subject: [PATCH 08/27] Delete python assignment.txt --- python assignment.txt | 45 ------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 python assignment.txt diff --git a/python assignment.txt b/python assignment.txt deleted file mode 100644 index b9d410c..0000000 --- a/python assignment.txt +++ /dev/null @@ -1,45 +0,0 @@ -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 isnt. - 3.Unicode represents most written languages in the world while ASCII does not. - 4.ASCII has its equivalent within Unicode \ No newline at end of file From 7e18ce8fd0b9a1e1de606900727a383f90e616d7 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:31:27 +0530 Subject: [PATCH 09/27] Delete python assignment 2-checkpoint.ipynb --- python assignment 2-checkpoint.ipynb | 191 --------------------------- 1 file changed, 191 deletions(-) delete mode 100644 python assignment 2-checkpoint.ipynb diff --git a/python assignment 2-checkpoint.ipynb b/python assignment 2-checkpoint.ipynb deleted file mode 100644 index b78e871..0000000 --- a/python assignment 2-checkpoint.ipynb +++ /dev/null @@ -1,191 +0,0 @@ -{ - "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 -} From e1ea5f74d5472375335339ddda6855da68378dd9 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:32:59 +0530 Subject: [PATCH 10/27] Delete assignment3.txt --- regex2/assignment3.txt | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 regex2/assignment3.txt diff --git a/regex2/assignment3.txt b/regex2/assignment3.txt deleted file mode 100644 index 5454636..0000000 --- a/regex2/assignment3.txt +++ /dev/null @@ -1,17 +0,0 @@ -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 \ No newline at end of file From b80c106db4b39a81566109cbbc1e871c39a68286 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:33:13 +0530 Subject: [PATCH 11/27] Delete leftover assignment.txt --- regex2/leftover assignment.txt | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 regex2/leftover assignment.txt diff --git a/regex2/leftover assignment.txt b/regex2/leftover assignment.txt deleted file mode 100644 index 8986b85..0000000 --- a/regex2/leftover assignment.txt +++ /dev/null @@ -1,25 +0,0 @@ -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*. - \ No newline at end of file From cb7462f1d4a0b8ef30906776cbf819265163c712 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:33:56 +0530 Subject: [PATCH 12/27] Delete assignment.txt --- Regex/assignment.txt | 47 -------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 Regex/assignment.txt diff --git a/Regex/assignment.txt b/Regex/assignment.txt deleted file mode 100644 index fd69c13..0000000 --- a/Regex/assignment.txt +++ /dev/null @@ -1,47 +0,0 @@ -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 doesnt 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 shells 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 users UID, using the id command: - - - id -u username - 1345 - -6. 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. - -7. 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 - From 95cad061a11c07d2fae0a8aefbf3d6157f6ceafe Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:45:05 +0530 Subject: [PATCH 13/27] Delete assignment.txt --- Tanya Sharma/assignment.txt | 47 ------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 Tanya Sharma/assignment.txt diff --git a/Tanya Sharma/assignment.txt b/Tanya Sharma/assignment.txt deleted file mode 100644 index fd69c13..0000000 --- a/Tanya Sharma/assignment.txt +++ /dev/null @@ -1,47 +0,0 @@ -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 doesnt 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 shells 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 users UID, using the id command: - - - id -u username - 1345 - -6. 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. - -7. 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 - From 095d46ebd6ce378a38de5a554ce924e2e7137e88 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:45:21 +0530 Subject: [PATCH 14/27] Delete Untitled-checkpoint.ipynb --- .../Tanya Sharma/Untitled-checkpoint.ipynb | 139 ------------------ 1 file changed, 139 deletions(-) delete mode 100644 Tanya Sharma/Tanya Sharma/Untitled-checkpoint.ipynb diff --git a/Tanya Sharma/Tanya Sharma/Untitled-checkpoint.ipynb b/Tanya Sharma/Tanya Sharma/Untitled-checkpoint.ipynb deleted file mode 100644 index 5cb34a8..0000000 --- a/Tanya Sharma/Tanya Sharma/Untitled-checkpoint.ipynb +++ /dev/null @@ -1,139 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Find the Armstrong Number between the two numbers which are input by user" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enter first number: 100\n", - "Enter second number: 500\n", - "153\n", - "370\n", - "371\n", - "407\n" - ] - } - ], - "source": [ - "first = int(input(\"Enter first number: \"))\n", - "second = int(input(\"Enter second number: \"))\n", - " \n", - "for num in range(first,second + 1):\n", - " sum = 0\n", - " temp = num\n", - " while temp > 0:\n", - " digit = temp % 10\n", - " sum += digit ** 3\n", - " temp //= 10\n", - " if num == sum:\n", - " print(num)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Remove the punctuation like [“@!#%&*()”] from the string" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "hello this world 2020\n" - ] - } - ], - "source": [ - "punctuations = '“@!#$%&*()”'\n", - "\n", - "my_str = \"hello this world @2020!!!\"\n", - "\n", - "no_punct = \"\"\n", - "for char in my_str:\n", - " if char not in punctuations:\n", - " no_punct = no_punct + char\n", - "print(no_punct)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Sort words in Alphabetical order" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "['Apple', 'banana', 'cat', 'REGEX', 'apple']\n" - ] - } - ], - "source": [ - "lst = [\"Apple\", \"banana\", \"cat\", \"REGEX\",\"apple\"]\n", - "sorted(lst) \n", - "print(lst) \n" - ] - }, - { - "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 -} From d7867c073db17635c1afc29ec8da03333a2a13d1 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:45:34 +0530 Subject: [PATCH 15/27] Delete assignment.txt --- Tanya Sharma/Tanya Sharma/assignment.txt | 47 ------------------------ 1 file changed, 47 deletions(-) delete mode 100644 Tanya Sharma/Tanya Sharma/assignment.txt diff --git a/Tanya Sharma/Tanya Sharma/assignment.txt b/Tanya Sharma/Tanya Sharma/assignment.txt deleted file mode 100644 index fd69c13..0000000 --- a/Tanya Sharma/Tanya Sharma/assignment.txt +++ /dev/null @@ -1,47 +0,0 @@ -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 doesnt 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 shells 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 users UID, using the id command: - - - id -u username - 1345 - -6. 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. - -7. 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 - From d7e94cf4fa52ed1a5dc72828eb638ec8876faced Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:45:45 +0530 Subject: [PATCH 16/27] Delete assignment3.txt --- Tanya Sharma/Tanya Sharma/assignment3.txt | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Tanya Sharma/Tanya Sharma/assignment3.txt diff --git a/Tanya Sharma/Tanya Sharma/assignment3.txt b/Tanya Sharma/Tanya Sharma/assignment3.txt deleted file mode 100644 index 5454636..0000000 --- a/Tanya Sharma/Tanya Sharma/assignment3.txt +++ /dev/null @@ -1,17 +0,0 @@ -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 \ No newline at end of file From 801801530406c2350690f8e18a2778d78185562c Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:45:58 +0530 Subject: [PATCH 17/27] Delete leftover assignment.txt --- .../Tanya Sharma/leftover assignment.txt | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 Tanya Sharma/Tanya Sharma/leftover assignment.txt diff --git a/Tanya Sharma/Tanya Sharma/leftover assignment.txt b/Tanya Sharma/Tanya Sharma/leftover assignment.txt deleted file mode 100644 index 8986b85..0000000 --- a/Tanya Sharma/Tanya Sharma/leftover assignment.txt +++ /dev/null @@ -1,25 +0,0 @@ -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*. - \ No newline at end of file From ab54b43fcac0da446319d5555c45df76855eae39 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:46:10 +0530 Subject: [PATCH 18/27] Delete python assignment 2.ipynb --- .../Tanya Sharma/python assignment 2.ipynb | 191 ------------------ 1 file changed, 191 deletions(-) delete mode 100644 Tanya Sharma/Tanya Sharma/python assignment 2.ipynb diff --git a/Tanya Sharma/Tanya Sharma/python assignment 2.ipynb b/Tanya Sharma/Tanya Sharma/python assignment 2.ipynb deleted file mode 100644 index b78e871..0000000 --- a/Tanya Sharma/Tanya Sharma/python assignment 2.ipynb +++ /dev/null @@ -1,191 +0,0 @@ -{ - "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 -} From 3c89ef871e79802c4f3a69aa10125b9b1a4ba3c1 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:46:21 +0530 Subject: [PATCH 19/27] Delete python assignment.txt --- .../Tanya Sharma/python assignment.txt | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 Tanya Sharma/Tanya Sharma/python assignment.txt diff --git a/Tanya Sharma/Tanya Sharma/python assignment.txt b/Tanya Sharma/Tanya Sharma/python assignment.txt deleted file mode 100644 index b9d410c..0000000 --- a/Tanya Sharma/Tanya Sharma/python assignment.txt +++ /dev/null @@ -1,45 +0,0 @@ -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 isnt. - 3.Unicode represents most written languages in the world while ASCII does not. - 4.ASCII has its equivalent within Unicode \ No newline at end of file From 279e151d06472585de7e57aaed1845e665f15075 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:46:53 +0530 Subject: [PATCH 20/27] Delete assignment3.txt --- Tanya Sharma/assignment3.txt | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Tanya Sharma/assignment3.txt diff --git a/Tanya Sharma/assignment3.txt b/Tanya Sharma/assignment3.txt deleted file mode 100644 index 5454636..0000000 --- a/Tanya Sharma/assignment3.txt +++ /dev/null @@ -1,17 +0,0 @@ -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 \ No newline at end of file From da101c834856190db40c6c54d2917c9b2df57207 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:47:20 +0530 Subject: [PATCH 21/27] Delete leftover assignment.txt --- Tanya Sharma/leftover assignment.txt | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 Tanya Sharma/leftover assignment.txt diff --git a/Tanya Sharma/leftover assignment.txt b/Tanya Sharma/leftover assignment.txt deleted file mode 100644 index 8986b85..0000000 --- a/Tanya Sharma/leftover assignment.txt +++ /dev/null @@ -1,25 +0,0 @@ -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*. - \ No newline at end of file From 7e2cecd00ede2b65a6dcb26900b27aaa7f2dc45a Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:47:35 +0530 Subject: [PATCH 22/27] Delete python assignment 2.ipynb --- Tanya Sharma/python assignment 2.ipynb | 191 ------------------------- 1 file changed, 191 deletions(-) delete mode 100644 Tanya Sharma/python assignment 2.ipynb diff --git a/Tanya Sharma/python assignment 2.ipynb b/Tanya Sharma/python assignment 2.ipynb deleted file mode 100644 index b78e871..0000000 --- a/Tanya Sharma/python assignment 2.ipynb +++ /dev/null @@ -1,191 +0,0 @@ -{ - "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 -} From b1bc955e186c8c2bd311441103a45c25d0aafee6 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:47:50 +0530 Subject: [PATCH 23/27] Delete python assignment.txt --- Tanya Sharma/python assignment.txt | 45 ------------------------------ 1 file changed, 45 deletions(-) delete mode 100644 Tanya Sharma/python assignment.txt diff --git a/Tanya Sharma/python assignment.txt b/Tanya Sharma/python assignment.txt deleted file mode 100644 index b9d410c..0000000 --- a/Tanya Sharma/python assignment.txt +++ /dev/null @@ -1,45 +0,0 @@ -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 isnt. - 3.Unicode represents most written languages in the world while ASCII does not. - 4.ASCII has its equivalent within Unicode \ No newline at end of file From 3442d38b51d92b943da806c14c35bec6292baef9 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Wed, 15 Apr 2020 18:52:02 +0530 Subject: [PATCH 24/27] Add files via upload --- Tanya Sharma/linux assignment 1.txt | 47 +++++ Tanya Sharma/linux assignment3.txt | 17 ++ .../linux leftover assignment of 1 and 2.txt | 25 +++ Tanya Sharma/python assignment 1.txt | 45 +++++ Tanya Sharma/python assignment 2.ipynb | 191 ++++++++++++++++++ Tanya Sharma/python assignment 3.ipynb | 139 +++++++++++++ 6 files changed, 464 insertions(+) create mode 100644 Tanya Sharma/linux assignment 1.txt create mode 100644 Tanya Sharma/linux assignment3.txt create mode 100644 Tanya Sharma/linux leftover assignment of 1 and 2.txt create mode 100644 Tanya Sharma/python assignment 1.txt create mode 100644 Tanya Sharma/python assignment 2.ipynb create mode 100644 Tanya Sharma/python assignment 3.ipynb diff --git a/Tanya Sharma/linux assignment 1.txt b/Tanya Sharma/linux assignment 1.txt new file mode 100644 index 0000000..fd69c13 --- /dev/null +++ b/Tanya Sharma/linux assignment 1.txt @@ -0,0 +1,47 @@ +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 doesnt 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 shells 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 users UID, using the id command: + + + id -u username + 1345 + +6. 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. + +7. 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 + diff --git a/Tanya Sharma/linux assignment3.txt b/Tanya Sharma/linux assignment3.txt new file mode 100644 index 0000000..5454636 --- /dev/null +++ b/Tanya Sharma/linux assignment3.txt @@ -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 \ No newline at end of file diff --git a/Tanya Sharma/linux leftover assignment of 1 and 2.txt b/Tanya Sharma/linux leftover assignment of 1 and 2.txt new file mode 100644 index 0000000..8986b85 --- /dev/null +++ b/Tanya Sharma/linux leftover assignment of 1 and 2.txt @@ -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*. + \ No newline at end of file diff --git a/Tanya Sharma/python assignment 1.txt b/Tanya Sharma/python assignment 1.txt new file mode 100644 index 0000000..b9d410c --- /dev/null +++ b/Tanya Sharma/python assignment 1.txt @@ -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 isnt. + 3.Unicode represents most written languages in the world while ASCII does not. + 4.ASCII has its equivalent within Unicode \ No newline at end of file diff --git a/Tanya Sharma/python assignment 2.ipynb b/Tanya Sharma/python assignment 2.ipynb new file mode 100644 index 0000000..b78e871 --- /dev/null +++ b/Tanya Sharma/python assignment 2.ipynb @@ -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 +} diff --git a/Tanya Sharma/python assignment 3.ipynb b/Tanya Sharma/python assignment 3.ipynb new file mode 100644 index 0000000..5cb34a8 --- /dev/null +++ b/Tanya Sharma/python assignment 3.ipynb @@ -0,0 +1,139 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Find the Armstrong Number between the two numbers which are input by user" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter first number: 100\n", + "Enter second number: 500\n", + "153\n", + "370\n", + "371\n", + "407\n" + ] + } + ], + "source": [ + "first = int(input(\"Enter first number: \"))\n", + "second = int(input(\"Enter second number: \"))\n", + " \n", + "for num in range(first,second + 1):\n", + " sum = 0\n", + " temp = num\n", + " while temp > 0:\n", + " digit = temp % 10\n", + " sum += digit ** 3\n", + " temp //= 10\n", + " if num == sum:\n", + " print(num)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Remove the punctuation like [“@!#%&*()”] from the string" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello this world 2020\n" + ] + } + ], + "source": [ + "punctuations = '“@!#$%&*()”'\n", + "\n", + "my_str = \"hello this world @2020!!!\"\n", + "\n", + "no_punct = \"\"\n", + "for char in my_str:\n", + " if char not in punctuations:\n", + " no_punct = no_punct + char\n", + "print(no_punct)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Sort words in Alphabetical order" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Apple', 'banana', 'cat', 'REGEX', 'apple']\n" + ] + } + ], + "source": [ + "lst = [\"Apple\", \"banana\", \"cat\", \"REGEX\",\"apple\"]\n", + "sorted(lst) \n", + "print(lst) \n" + ] + }, + { + "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 +} From 7ef8d1fd866a869a34ba8213638868a2e90da59c Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Sat, 18 Apr 2020 19:21:42 +0530 Subject: [PATCH 25/27] python assignment 4 --- Tanya Sharma/python assignment 4.ipynb | 300 +++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 Tanya Sharma/python assignment 4.ipynb diff --git a/Tanya Sharma/python assignment 4.ipynb b/Tanya Sharma/python assignment 4.ipynb new file mode 100644 index 0000000..1c9d573 --- /dev/null +++ b/Tanya Sharma/python assignment 4.ipynb @@ -0,0 +1,300 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Write a Program to print new list which contains all the first Characters of strings present in a list" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['G', 'R', 'K', 'G', 'M', 'M']\n" + ] + } + ], + "source": [ + "LIST_STATES = [\"GOA\",\"RAJASTHAN\",\"KARNATAKA\",\"GUJARAT\",\"MANIPUR\",\"MADHYA PRADESH\"]\n", + "new_list=[]\n", + "for i in LIST_STATES:\n", + " new_list.append(i[0])\n", + "print(new_list)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 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........" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[478, 992, 1602, 2221, 2913]\n" + ] + } + ], + "source": [ + "list= ['Ganga', 'Tapti', 'Kaveri', 'Yamuna', 'Narmada']\n", + "new_list=[]\n", + "ascii_value=0\n", + "for i in list:\n", + " for a in i:\n", + " ascii_value+=ord(a)\n", + " new_list.append(ascii_value)\n", + "print(new_list)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# you have to run your program at 9:00am date 14th april 2020\n", + "# and convert it into list format" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2020-04-14 09:00:00\n" + ] + } + ], + "source": [ + "import datetime\n", + "import time\n", + "task_date = datetime.datetime(2020, 4, 14, 9, 0, 0)\n", + "while datetime.datetime.now() < task_date:\n", + " time.sleep(1)\n", + "\n", + "print(task_date)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Take a list REGex=[1,2,3,4,5,6,7,8,9,0,77,44,15,33,65,89,12]\n", + "### print only those numbers greator then 20\n", + "### then print those numbers those are less then 10 or equal to 10\n", + "### store these above two list in two different list." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "numbers greater than 20: [77, 44, 33, 65, 89]\n", + "numbers less than or equal to 10: [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]\n" + ] + } + ], + "source": [ + "REGex=[1,2,3,4,5,6,7,8,9,0,77,44,15,33,65,89,12]\n", + "greater=[]\n", + "less=[]\n", + "for i in REGex:\n", + " if i > 20:\n", + " greater.append(i)\n", + "for i in REGex:\n", + " if i<= 10:\n", + " less.append(i)\n", + "print(\"numbers greater than 20: \",greater)\n", + "print(\"numbers less than or equal to 10:\",less)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Give a tuple:\n", + "### tuple = ('a','l','g','o','r','i','t','h','m')\n", + "### 1. Using the concept of slicing, print the whole tuple\n", + "### 2. delete the element at the 3rd Index, print the tuple." + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "('a', 'l', 'g', 'o', 'r', 'i', 't', 'h', 'm')\n", + "('a', 'l', 'g', 'r', 'i', 't', 'h', 'm')\n" + ] + } + ], + "source": [ + "tuple1 = ('a','l','g','o','r','i','t','h','m')\n", + "\n", + "#print the tuple using slicing\n", + "print(tuple1[::1])\n", + "\n", + "# deleting the 3rd value of the index\n", + "a=tuple1[:3]+tuple1[4:]\n", + "print(a)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# execute standard linux commands using python programming" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import os\n", + "os.system('ls -l')" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from subprocess import call\n", + "call('echo \"I like potatos\"', shell=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# revise kwargs and args" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "14\n", + "This is a Program\n" + ] + } + ], + "source": [ + "def add(*args):\n", + " total = 0\n", + " for i in args:\n", + " total += i\n", + " return total\n", + "\n", + "def sum(**kwargs):\n", + " result = \"\"\n", + " for arg in kwargs.values():\n", + " result += arg\n", + " return result\n", + "\n", + "print(add(5, 8, 1))\n", + "print(sum(a=\"This\", b=\" is\", c=\" a\", d=\" Program\"))\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "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 +} From 87cc4ce534a49cef64cb1d211027aec8b2ebab2a Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:15:05 +0530 Subject: [PATCH 26/27] Add files via upload python all tasks except the last night task --- Tanya Sharma/CoronaCases.csv | 3315 +++++++++++++++++++++ Tanya Sharma/linux assignment 1 and 2.txt | 47 + Tanya Sharma/linux assignment 1.txt | 31 +- Tanya Sharma/python assignment 5.ipynb | 224 ++ Tanya Sharma/python assignment 6.ipynb | 210 ++ Tanya Sharma/test.txt | 3 + Tanya Sharma/test/A.txt | 1 + Tanya Sharma/test/B.txt | 1 + Tanya Sharma/test/C.txt | 1 + Tanya Sharma/test/D.txt | 1 + Tanya Sharma/test/E.txt | 1 + Tanya Sharma/test/F.txt | 1 + Tanya Sharma/test/G.txt | 1 + Tanya Sharma/test/H.txt | 1 + Tanya Sharma/test/I.txt | 1 + Tanya Sharma/test/J.txt | 1 + Tanya Sharma/test/K.txt | 1 + Tanya Sharma/test/L.txt | 1 + Tanya Sharma/test/M.txt | 1 + Tanya Sharma/test/N.txt | 1 + Tanya Sharma/test/O.txt | 1 + Tanya Sharma/test/P.txt | 1 + Tanya Sharma/test/Q.txt | 1 + Tanya Sharma/test/R.txt | 1 + Tanya Sharma/test/S.txt | 1 + Tanya Sharma/test/T.txt | 1 + Tanya Sharma/test/U.txt | 1 + Tanya Sharma/test/V.txt | 1 + Tanya Sharma/test/W.txt | 1 + Tanya Sharma/test/X.txt | 1 + Tanya Sharma/test/Y.txt | 1 + Tanya Sharma/test/Z.txt | 1 + Tanya Sharma/words1.txt | 9 + 33 files changed, 3863 insertions(+), 2 deletions(-) create mode 100644 Tanya Sharma/CoronaCases.csv create mode 100644 Tanya Sharma/linux assignment 1 and 2.txt create mode 100644 Tanya Sharma/python assignment 5.ipynb create mode 100644 Tanya Sharma/python assignment 6.ipynb create mode 100644 Tanya Sharma/test.txt create mode 100644 Tanya Sharma/test/A.txt create mode 100644 Tanya Sharma/test/B.txt create mode 100644 Tanya Sharma/test/C.txt create mode 100644 Tanya Sharma/test/D.txt create mode 100644 Tanya Sharma/test/E.txt create mode 100644 Tanya Sharma/test/F.txt create mode 100644 Tanya Sharma/test/G.txt create mode 100644 Tanya Sharma/test/H.txt create mode 100644 Tanya Sharma/test/I.txt create mode 100644 Tanya Sharma/test/J.txt create mode 100644 Tanya Sharma/test/K.txt create mode 100644 Tanya Sharma/test/L.txt create mode 100644 Tanya Sharma/test/M.txt create mode 100644 Tanya Sharma/test/N.txt create mode 100644 Tanya Sharma/test/O.txt create mode 100644 Tanya Sharma/test/P.txt create mode 100644 Tanya Sharma/test/Q.txt create mode 100644 Tanya Sharma/test/R.txt create mode 100644 Tanya Sharma/test/S.txt create mode 100644 Tanya Sharma/test/T.txt create mode 100644 Tanya Sharma/test/U.txt create mode 100644 Tanya Sharma/test/V.txt create mode 100644 Tanya Sharma/test/W.txt create mode 100644 Tanya Sharma/test/X.txt create mode 100644 Tanya Sharma/test/Y.txt create mode 100644 Tanya Sharma/test/Z.txt create mode 100644 Tanya Sharma/words1.txt diff --git a/Tanya Sharma/CoronaCases.csv b/Tanya Sharma/CoronaCases.csv new file mode 100644 index 0000000..03d884b --- /dev/null +++ b/Tanya Sharma/CoronaCases.csv @@ -0,0 +1,3315 @@ + + + +North America + +998,393 ++2,056 +56,389 ++194 +135,476 +806,528 +16,346 + + + + +North America + + + +Europe + +1,226,254 ++940 +117,376 ++52 +397,458 +711,420 +26,163 + + + + +Europe + + + +Asia + +449,579 ++1,363 +16,630 ++27 +213,173 +219,776 +6,055 + + + + +Asia + + + +South America + +121,322 ++1,156 +5,573 ++35 +45,573 +70,176 +9,620 + + + + +South America + + + +Oceania + +8,257 ++25 +98 ++2 +6,558 +1,601 +46 + + + + +Australia/Oceania + + + +Africa + +29,840 + +1,328 + +9,140 +19,372 +148 + + + + +Africa + + + + + +721 + +15 + +645 +61 +4 + + + + + + + +World +2,834,366 ++5,540 +197,409 ++310 +808,023 +1,828,934 +58,382 +364 +25.3 + + +All + + +USA +925,758 ++526 +52,217 ++24 +110,432 +763,109 +15,097 +2,797 +158 +5,037,473 +15,219 +North America + + +Spain +219,764 + +22,524 + +92,355 +104,885 +7,705 +4,700 +482 +930,230 +19,896 +Europe + + +Italy +192,994 + +25,969 + +60,498 +106,527 +2,173 +3,192 +430 +1,642,356 +27,164 +Europe + + +France +159,828 + +22,245 + +43,493 +94,090 +4,870 +2,449 +341 +463,662 +7,103 +Europe + + +Germany +155,054 ++55 +5,767 ++7 +109,800 +39,487 +2,908 +1,851 +69 +2,072,669 +24,738 +Europe + + +UK +143,464 + +19,506 + +N/A +123,614 +1,559 +2,113 +287 +612,031 +9,016 +Europe + + +Turkey +104,912 + +2,600 + +21,737 +80,575 +1,790 +1,244 +31 +830,257 +9,844 +Asia + + +Iran +88,194 + +5,574 + +66,599 +16,021 +3,121 +1,050 +66 +399,927 +4,761 +Asia + + +Russia +68,622 + +615 + +5,568 +62,439 +2,300 +470 +4 +2,550,000 +17,474 +Europe + + +Brazil +54,043 ++1,048 +3,704 ++34 +27,655 +22,684 +8,318 +254 +17 +291,922 +1,373 +South America + + +Belgium +44,293 + +6,679 + +10,122 +27,492 +970 +3,822 +576 +189,067 +16,313 +Europe + + +Canada +43,888 + +2,302 + +15,469 +26,117 +557 +1,163 +61 +660,108 +17,490 +North America + + +Netherlands +36,535 + +4,289 + +N/A +31,996 +963 +2,132 +250 +187,000 +10,913 +Europe + + +Switzerland +28,677 + +1,589 + +21,000 +6,088 +204 +3,313 +184 +235,252 +27,182 +Europe + + +India +24,530 ++83 +780 + +5,498 +18,252 + +18 +0.6 +579,957 +420 +Asia + + +Portugal +22,797 + +854 + +1,228 +20,715 +188 +2,236 +84 +315,758 +30,967 +Europe + + +Ecuador +22,719 + +576 + +1,366 +20,777 +127 +1,288 +33 +56,513 +3,203 +South America + + +Peru +21,648 + +634 + +7,496 +13,518 +505 +657 +19 +198,349 +6,016 +South America + + +Ireland +18,184 + +1,014 + +9,233 +7,937 +142 +3,683 +205 +111,584 +22,598 +Europe + + +Sweden +17,567 + +2,152 + +1,005 +14,410 +547 +1,739 +213 +94,500 +9,357 +Europe + + +Austria +15,148 ++77 +536 ++6 +12,103 +2,509 +148 +1,682 +60 +221,098 +24,549 +Europe + + +Saudi Arabia +15,102 + +127 + +2,049 +12,926 +93 +434 +4 +200,000 +5,745 +Asia + + +Israel +15,058 + +194 + +6,003 +8,861 +137 +1,740 +22 +302,691 +34,971 +Asia + + +Mexico +12,872 ++1,239 +1,221 ++152 +7,149 +4,502 +378 +100 +9 +51,297 +398 +North America + + +Japan +12,829 ++117 +345 + +1,530 +10,954 +263 +101 +3 +141,600 +1,120 +Asia + + +Singapore +12,693 ++618 +12 + +956 +11,725 +24 +2,170 +2 +121,774 +20,815 +Asia + + +Chile +12,306 + +174 + +6,327 +5,805 +408 +644 +9 +142,267 +7,442 +South America + + +Pakistan +11,940 + +253 + +2,755 +8,932 +111 +54 +1 +138,147 +625 +Asia + + +Poland +11,067 ++175 +499 ++5 +2,126 +8,442 +160 +292 +13 +265,201 +7,007 +Europe + + +S. Korea +10,718 ++10 +240 + +8,635 +1,843 +55 +209 +5 +595,161 +11,609 +Asia + + +Romania +10,417 + +575 ++8 +2,817 +7,025 +241 +541 +30 +121,602 +6,321 +Europe + + +UAE +9,281 + +64 + +1,760 +7,457 +1 +938 +6 +790,000 +79,875 +Asia + + +Belarus +8,773 + +63 + +1,120 +7,590 +92 +928 +7 +130,824 +13,845 +Europe + + +Qatar +8,525 + +10 + +809 +7,706 +72 +2,959 +3 +75,888 +26,340 +Asia + + +Indonesia +8,211 + +689 + +1,002 +6,520 + +30 +3 +64,054 +234 +Asia + + +Denmark +8,210 + +403 + +5,526 +2,281 +69 +1,417 +70 +125,329 +21,638 +Europe + + +Ukraine +8,125 ++478 +201 ++8 +782 +7,142 +104 +186 +5 +83,577 +1,911 +Europe + + +Serbia +7,483 + +144 + +1,094 +6,245 +96 +856 +16 +54,887 +6,282 +Europe + + +Norway +7,463 + +199 + +32 +7,232 +53 +1,377 +37 +155,125 +28,614 +Europe + + +Philippines +7,294 ++102 +494 ++17 +792 +6,008 +1 +67 +5 +76,956 +702 +Asia + + +Czechia +7,273 + +215 ++1 +2,389 +4,669 +71 +679 +20 +210,705 +19,676 +Europe + + +Australia +6,695 ++20 +80 ++1 +5,372 +1,243 +43 +263 +3 +494,257 +19,383 +Australia/Oceania + + +Dominican Republic +5,749 + +267 + +763 +4,719 +135 +530 +25 +18,261 +1,683 +North America + + +Malaysia +5,742 ++51 +98 ++2 +3,762 +1,882 +36 +177 +3 +121,722 +3,761 +Asia + + +Panama +5,338 ++172 +154 ++8 +319 +4,865 +87 +1,237 +36 +24,304 +5,633 +North America + + +Colombia +4,881 + +225 + +1,003 +3,653 +117 +96 +4 +78,078 +1,534 +South America + + +Bangladesh +4,689 + +131 + +112 +4,446 +1 +28 +0.8 +39,476 +240 +Asia + + +Finland +4,395 + +177 + +2,500 +1,718 +61 +793 +32 +74,500 +13,446 +Europe + + +South Africa +4,220 + +79 + +1,473 +2,668 +36 +71 +1 +152,390 +2,569 +Africa + + +Egypt +4,092 + +294 + +1,075 +2,723 + +40 +3 +90,000 +879 +Africa + + +Morocco +3,758 + +158 + +486 +3,114 +1 +102 +4 +23,933 +648 +Africa + + +Luxembourg +3,695 + +85 + +3,007 +603 +25 +5,903 +136 +37,782 +60,357 +Europe + + +Argentina +3,607 + +176 + +976 +2,455 +123 +80 +4 +44,654 +988 +South America + + +Algeria +3,127 + +415 + +1,408 +1,304 +40 +71 +9 +6,500 +148 +Africa + + +Moldova +3,110 + +87 ++3 +825 +2,198 +212 +771 +22 +11,763 +2,916 +Europe + + +Thailand +2,907 ++53 +51 ++1 +2,547 +309 +61 +42 +0.7 +142,589 +2,043 +Asia + + +Kuwait +2,614 + +15 + +613 +1,986 +60 +612 +4 + + +Asia + + +Bahrain +2,518 + +8 + +1,113 +1,397 +1 +1,480 +5 +107,273 +63,043 +Asia + + +Greece +2,490 + +130 + +577 +1,783 +48 +239 +12 +61,407 +5,891 +Europe + + +Kazakhstan +2,482 ++66 +25 + +604 +1,853 +31 +132 +1 +180,502 +9,613 +Asia + + +Hungary +2,443 ++60 +262 ++12 +458 +1,723 +61 +253 +27 +60,801 +6,294 +Europe + + +Croatia +2,009 + +51 + +982 +976 +19 +489 +12 +30,213 +7,360 +Europe + + +Uzbekistan +1,836 ++32 +8 + +621 +1,207 +8 +55 +0.2 +210,000 +6,274 +Asia + + +Oman +1,790 + +10 + +325 +1,455 +3 +351 +2 + + +Asia + + +Iceland +1,789 + +10 + +1,542 +237 +5 +5,243 +29 +45,286 +132,709 +Europe + + +Iraq +1,708 + +86 + +1,204 +418 + +42 +2 +67,293 +1,673 +Asia + + +Armenia +1,677 ++81 +28 ++1 +803 +846 +10 +566 +9 +17,342 +5,852 +Asia + + +Estonia +1,605 + +46 + +206 +1,353 +6 +1,210 +35 +46,281 +34,889 +Europe + + +Azerbaijan +1,592 + +21 + +1,013 +558 +14 +157 +2 +114,410 +11,284 +Asia + + +Afghanistan +1,463 ++112 +47 ++4 +188 +1,228 +7 +38 +1 +6,422 +165 +Asia + + +New Zealand +1,461 ++5 +18 ++1 +1,118 +325 +1 +303 +4 +115,015 +23,851 +Australia/Oceania + + +Cameroon +1,430 + +43 + +668 +719 +20 +54 +2 + + +Africa + + +Lithuania +1,426 ++16 +41 ++1 +460 +925 +17 +524 +15 +98,948 +36,347 +Europe + + +Bosnia and Herzegovina +1,421 + +55 + +538 +828 +4 +433 +17 +21,432 +6,533 +Europe + + +Slovenia +1,373 + +80 + +211 +1,082 +23 +660 +38 +45,703 +21,984 +Europe + + +Slovakia +1,373 ++13 +17 + +386 +970 +7 +251 +3 +66,089 +12,105 +Europe + + +North Macedonia +1,326 + +57 + +337 +932 +14 +636 +27 +13,649 +6,551 +Europe + + +Cuba +1,285 + +49 + +416 +820 +11 +113 +4 +36,134 +3,190 +North America + + +Ghana +1,279 + +10 + +134 +1,135 +4 +41 +0.3 +88,188 +2,838 +Africa + + +Bulgaria +1,234 ++46 +54 + +197 +983 +37 +178 +8 +27,000 +3,886 +Europe + + +Nigeria +1,095 + +32 + +208 +855 +2 +5 +0.2 +10,061 +49 +Africa + + +Ivory Coast +1,077 + +14 + +419 +644 + +41 +0.5 + + +Africa + + +Hong Kong +1,036 + +4 + +725 +307 +7 +138 +0.5 +145,640 +19,426 +Asia + + +Djibouti +999 + +2 + +330 +667 + +1,011 +2 +11,090 +11,225 +Africa + + +Guinea +954 + +6 + +191 +757 + +73 +0.5 + + +Africa + + +Tunisia +922 + +38 + +194 +690 +20 +78 +3 +19,849 +1,679 +Africa + + +Bolivia +807 ++104 +44 ++1 +54 +709 +3 +69 +4 +4,995 +428 +South America + + +Cyprus +804 + +14 + +98 +692 +15 +666 +12 +43,542 +36,064 +Asia + + +Latvia +804 ++20 +12 + +267 +525 +6 +426 +6 +45,743 +24,251 +Europe + + +Andorra +731 + +40 + +344 +347 +17 +9,461 +518 +1,673 +21,653 +Europe + + +Diamond Princess +712 + +13 + +645 +54 +4 + + + + + + + +Lebanon +696 + +24 ++2 +140 +532 +46 +102 +4 +25,337 +3,712 +Asia + + +Costa Rica +687 + +6 + +216 +465 +7 +135 +1 +12,342 +2,423 +North America + + +Niger +681 + +24 + +289 +368 + +28 +1.0 +4,832 +200 +Africa + + +Albania +678 + +27 + +394 +257 +4 +236 +9 +6,768 +2,352 +Europe + + +Kyrgyzstan +665 ++9 +8 + +345 +312 +11 +102 +1 +39,615 +6,072 +Asia + + +Burkina Faso +629 + +41 + +425 +163 + +30 +2 + + +Africa + + +Honduras +591 ++29 +55 ++8 +58 +478 +10 +60 +6 +3,457 +349 +North America + + +Uruguay +563 + +12 + +369 +182 +9 +162 +3 +15,834 +4,558 +South America + + +Senegal +545 + +7 + +262 +276 +1 +33 +0.4 +466 +28 +Africa + + +Channel Islands +523 + +34 + +295 +194 + +3,008 +196 +3,320 +19,095 +Europe + + +San Marino +513 + +40 + +64 +409 +3 +15,119 +1,179 +1,929 +56,851 +Europe + + +Palestine +484 + +4 + +92 +388 + +95 +0.8 +27,000 +5,293 +Asia + + +Georgia +456 ++12 +5 + +132 +319 +6 +114 +1 +9,699 +2,431 +Asia + + +Malta +447 + +4 ++1 +223 +220 +2 +1,012 +9 +27,422 +62,105 +Europe + + +Jordan +441 + +7 + +326 +108 +5 +43 +0.7 +61,608 +6,038 +Asia + + +Guatemala +430 ++46 +11 + +30 +389 +5 +24 +0.6 +7,200 +402 +North America + + +Taiwan +429 ++1 +6 + +275 +148 + +18 +0.3 +59,840 +2,513 +Asia + + +Sri Lanka +420 ++3 +7 + +116 +297 +2 +20 +0.3 +13,142 +614 +Asia + + +Runion +412 + + + +300 +112 +2 +460 + + + +Africa + + +DRC +394 + +25 + +48 +321 + +4 +0.3 + + +Africa + + +Mayotte +354 + +4 + +144 +206 +4 +1,298 +15 +2,200 +8,064 +Africa + + +Kenya +336 + +14 + +94 +228 +2 +6 +0.3 +16,738 +311 +Africa + + +Mauritius +331 + +9 + +285 +37 +3 +260 +7 +13,374 +10,516 +Africa + + +Somalia +328 + +16 + +8 +304 +2 +21 +1 + + +Africa + + +Mali +325 + +21 + +87 +217 + +16 +1 +2,172 +107 +Africa + + +Montenegro +319 + +6 + +123 +190 +7 +508 +10 +5,085 +8,096 +Europe + + +Venezuela +318 + +10 + +132 +176 +4 +11 +0.4 +394,125 +13,860 +South America + + +Isle of Man +308 + +18 + +230 +60 +20 +3,622 +212 +2,751 +32,352 +Europe + + +Tanzania +299 + +10 + +48 +241 +7 +5 +0.2 + + +Africa + + +Jamaica +288 ++31 +7 + +28 +253 + +97 +2 +2,518 +850 +North America + + +El Salvador +274 ++13 +8 + +75 +191 +2 +42 +1 +17,423 +2,686 +North America + + +Vietnam +270 + + + +220 +50 +8 +3 + +206,253 +2,119 +Asia + + +Paraguay +223 ++3 +9 + +78 +136 +1 +31 +1 +6,917 +970 +South America + + +Equatorial Guinea +214 + +1 + +7 +206 + +153 +0.7 +854 +609 +Africa + + +Congo +200 + +6 + +19 +175 + +36 +1 + + +Africa + + +Faeroe Islands +187 + + + +178 +9 + +3,827 + +6,548 +134,007 +Europe + + +Rwanda +176 + + + +87 +89 + +14 + +6,959 +537 +Africa + + +Sudan +174 + +16 + +14 +144 + +4 +0.4 + + +Africa + + +Gabon +172 + +3 + +26 +143 +1 +77 +1 +572 +257 +Africa + + +Martinique +170 + +14 + +77 +79 +6 +453 +37 + + +North America + + +Guadeloupe +149 + +12 + +82 +55 +11 +372 +30 + + +North America + + +Myanmar +144 + +5 + +9 +130 + +3 +0.09 +6,124 +113 +Asia + + +Brunei +138 + +1 + +120 +17 +2 +315 +2 +12,770 +29,190 +Asia + + +Gibraltar +133 + + + +131 +2 + +3,948 + +2,105 +62,480 +Europe + + +Maldives +129 + + + +16 +113 +2 +239 + +5,296 +9,798 +Asia + + +Cambodia +122 + + + +117 +5 +1 +7 + +5,768 +345 +Asia + + +Madagascar +122 + + + +61 +61 +1 +4 + +2,357 +85 +Africa + + +Liberia +117 + +8 + +25 +84 + +23 +2 + + +Africa + + +Ethiopia +117 + +3 + +25 +89 + +1 +0.03 +11,669 +102 +Africa + + +Trinidad and Tobago +115 + +8 + +48 +59 + +82 +6 +1,501 +1,073 +North America + + +French Guiana +111 + +1 + +87 +23 + +372 +3 + + +South America + + +Aruba +100 + +2 + +69 +29 +4 +937 +19 +1,577 +14,771 +North America + + +Bermuda +99 + +5 + +39 +55 +10 +1,590 +80 +949 +15,238 +North America + + +Monaco +94 + +4 + +41 +49 +2 +2,395 +102 + + +Europe + + +Togo +90 + +6 + +59 +25 + +11 +0.7 +4,733 +572 +Africa + + +Cabo Verde +88 + +1 + +1 +86 + +158 +2 +791 +1,423 +Africa + + +Zambia +84 + +3 + +37 +44 +1 +5 +0.2 +2,586 +141 +Africa + + +Sierra Leone +82 + +2 + +10 +70 + +10 +0.3 + + +Africa + + +Liechtenstein +81 + +1 + +55 +25 + +2,124 +26 +900 +23,605 +Europe + + +Barbados +77 + +6 + +31 +40 +4 +268 +21 +1,327 +4,618 +North America + + +Uganda +75 + + + +46 +29 + +2 + +18,921 +414 +Africa + + +Sint Maarten +73 + +12 + +22 +39 +8 +1,703 +280 +266 +6,204 +North America + + +Bahamas +73 + +11 + +15 +47 +1 +186 +28 + + +North America + + +Guyana +73 + +7 + +12 +54 +5 +93 +9 +375 +477 +South America + + +Haiti +72 + +6 ++1 +6 +60 + +6 +0.5 +719 +63 +North America + + +Cayman Islands +70 + +1 + +8 +61 +3 +1,065 +15 +940 +14,303 +North America + + +Mozambique +65 + + + +12 +53 + +2 + +1,439 +46 +Africa + + +Libya +61 + +2 + +18 +41 + +9 +0.3 +1,337 +195 +Africa + + +French Polynesia +57 + + + +41 +16 +1 +203 + +2,069 +7,365 +Australia/Oceania + + +Benin +54 + +1 + +27 +26 + +4 +0.08 + + +Africa + + +Guinea-Bissau +52 + + + +3 +49 + +26 + +1,500 +762 +Africa + + +Nepal +49 + + + +11 +38 + +2 + +47,497 +1,630 +Asia + + +Macao +45 + + + +27 +18 +1 +69 + + + +Asia + + +Syria +42 + +3 + +6 +33 + +2 +0.2 + + +Asia + + +Chad +40 + + + +8 +32 + +2 + + + +Africa + + +Eritrea +39 + + + +11 +28 + +11 + + + +Africa + + +Saint Martin +38 + +3 + +24 +11 +3 +983 +78 + + +North America + + +Mongolia +37 ++1 + + +9 +28 + +11 + +7,292 +2,224 +Asia + + +Eswatini +36 + +1 + +10 +25 + +31 +0.9 +714 +615 +Africa + + +Malawi +33 + +3 + +4 +26 +1 +2 +0.2 +566 +30 +Africa + + +Zimbabwe +29 + +4 + +2 +23 + +2 +0.3 +5,450 +367 +Africa + + +Angola +25 + +2 + +6 +17 + +0.8 +0.06 + + +Africa + + +Antigua and Barbuda +24 + +3 + +11 +10 +1 +245 +31 +113 +1,154 +North America + + +Timor-Leste +24 + + + +2 +22 + +18 + +322 +244 +Asia + + +Botswana +22 + +1 + + +21 + +9 +0.4 +5,023 +2,136 +Africa + + +Laos +19 + + + +7 +12 + +3 + +1,661 +228 +Asia + + +Belize +18 + +2 + +5 +11 +1 +45 +5 +816 +2,052 +North America + + +Fiji +18 + + + +10 +8 + +20 + +900 +1,004 +Australia/Oceania + + +New Caledonia +18 + + + +17 +1 +1 +63 + +3,952 +13,842 +Australia/Oceania + + +Curaao +16 + +1 + +11 +4 + +98 +6 +304 +1,853 +North America + + +CAR +16 + + + +10 +6 + +3 + + + +Africa + + +Dominica +16 + + + +10 +6 + +222 + +383 +5,320 +North America + + +Namibia +16 + + + +7 +9 + +6 + +590 +232 +Africa + + +Grenada +15 + + + +7 +8 +4 +133 + +92 +818 +North America + + +Saint Kitts and Nevis +15 + + + +2 +13 + +282 + +260 +4,887 +North America + + +Saint Lucia +15 + + + +15 +0 + +82 + +364 +1,982 +North America + + +St. Vincent Grenadines +14 + + + +5 +9 + +126 + +108 +973 +North America + + +Falkland Islands +13 ++1 + + +11 +2 + +3,736 + +353 +101,437 +South America + + +Nicaragua +11 + +3 + +7 +1 + +2 +0.5 + + +North America + + +Burundi +11 + +1 + +4 +6 + +0.9 +0.08 +284 +24 +Africa + + +Montserrat +11 + +1 ++1 +2 +8 +1 +2,204 +200 +36 +7,212 +North America + + +Turks and Caicos +11 + +1 + +4 +6 + +284 +26 +83 +2,144 +North America + + +Greenland +11 + + + +11 +0 + +194 + +1,150 +20,257 +North America + + +Seychelles +11 + + + +6 +5 + +112 + + + +Africa + + +Gambia +10 + +1 + +8 +1 + +4 +0.4 +401 +166 +Africa + + +Suriname +10 + +1 + +7 +2 + +17 +2 +404 +689 +South America + + +MS Zaandam +9 + +2 + + +7 + + + + + + + + +Vatican City +9 + + + +2 +7 + +11,236 + + + +Europe + + +Papua New Guinea +8 + + + + +8 + +0.9 + +604 +68 +Australia/Oceania + + +Mauritania +7 + +1 + +6 +0 + +2 +0.2 +1,032 +222 +Africa + + +Bhutan +7 + + + +3 +4 + +9 + +8,953 +11,603 +Asia + + +St. Barth +6 + + + +6 +0 + +607 + + + +North America + + +Western Sahara +6 + + + +5 +1 + +10 + + + +Africa + + +British Virgin Islands +5 + +1 + +3 +1 + +165 +33 + + +North America + + +Caribbean Netherlands +5 + + + + +5 + +191 + +110 +4,195 +North America + + +South Sudan +5 + + + + +5 + +0.4 + + + +Africa + + +Sao Tome and Principe +4 + + + + +4 + +18 + +19 +87 +Africa + + +Anguilla +3 + + + +1 +2 + +200 + + + +North America + + +Saint Pierre Miquelon +1 + + + + +1 + +173 + + + +North America + + +Yemen +1 + + + +1 +0 + +0.03 + +120 +4 +Asia + + +China +82,816 ++12 +4,632 + +77,346 +838 +49 +58 +3 + + +Asia + diff --git a/Tanya Sharma/linux assignment 1 and 2.txt b/Tanya Sharma/linux assignment 1 and 2.txt new file mode 100644 index 0000000..fd69c13 --- /dev/null +++ b/Tanya Sharma/linux assignment 1 and 2.txt @@ -0,0 +1,47 @@ +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 doesnt 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 shells 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 users UID, using the id command: + + + id -u username + 1345 + +6. 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. + +7. 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 + diff --git a/Tanya Sharma/linux assignment 1.txt b/Tanya Sharma/linux assignment 1.txt index fd69c13..f7318c0 100644 --- a/Tanya Sharma/linux assignment 1.txt +++ b/Tanya Sharma/linux assignment 1.txt @@ -33,7 +33,34 @@ Ans. Use the -u (--uid) option to create a user with a specific UID. id -u username 1345 -6. How to change the group of files and the folder with a single command? + +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.. @@ -42,6 +69,6 @@ GROUP, name of the new group FILE... name of one or more files. -7. Create a new user and at the same time you have to add that user into the group you already have? +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 diff --git a/Tanya Sharma/python assignment 5.ipynb b/Tanya Sharma/python assignment 5.ipynb new file mode 100644 index 0000000..7bb6432 --- /dev/null +++ b/Tanya Sharma/python assignment 5.ipynb @@ -0,0 +1,224 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# make a use of time module and for loop\n", + "# output should be: Loading... in animated form" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loading....." + ] + } + ], + "source": [ + "import time\n", + "print(\"Loading\", end=\"\")\n", + "i=1\n", + "while(i<6):\n", + " print(\".\",end=\"\")\n", + " time.sleep(1)\n", + " i+=1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# difference between return nd yield" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Return sends a specified value back to its caller whereas Yield can produce a sequence of values. We should use yield when we want to iterate over a sequence, but don’t want to store the entire sequence in memory." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n", + "2\n", + "3\n" + ] + } + ], + "source": [ + "# example\n", + "def simple():\n", + " yield 1\n", + " yield 2\n", + " yield 3\n", + "for value in simple(): \n", + " print(value) \n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#return example\n", + "def simple():\n", + " return 1\n", + "simple()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# make a digital clock and run it for 5 sec" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "16:29:43\n", + "16:29:44\n", + "16:29:45\n", + "16:29:46\n", + "16:29:47\n" + ] + } + ], + "source": [ + "import time\n", + "for i in range(5):\n", + " a=str(time.ctime())\n", + " b=a.split(\" \")\n", + " print(b[3])\n", + " time.sleep(1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# add anything in tupple" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(1, 2, 3, 4, 5)\n" + ] + } + ], + "source": [ + "t=(1,2,3,4)\n", + "t1=(5,)\n", + "new_tupple=t+t1\n", + "print(new_tupple)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# send whatsapp message to a specific friend using webbrowser m" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import pyautogui,time\n", + "pyautogui.FAILSAFE=False\n", + "import webbrowser\n", + "webbrowser.open_new_tab(\"https://wa.me/919149654345?text=hii\")\n", + "time.sleep(60)\n", + "pyautogui.drag(1797,968)\n", + "pyautogui.click(1797,968)" + ] + }, + { + "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 +} diff --git a/Tanya Sharma/python assignment 6.ipynb b/Tanya Sharma/python assignment 6.ipynb new file mode 100644 index 0000000..ed8742d --- /dev/null +++ b/Tanya Sharma/python assignment 6.ipynb @@ -0,0 +1,210 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Write a Python program to read a file line by line and store it into a list." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['readlines() is used to read all the lines at a single go and then return them as each line a string element in a list. \\n', 'This function can be used for small files, as it reads the whole file content to the memory, then split it into separate lines. \\n', \"We can iterate over the list and strip the newline '\\\\n' character using strip() function.\"]\n" + ] + } + ], + "source": [ + "def file(fname):\n", + " with open(fname) as f:\n", + " file_list = f.readlines()\n", + " print(file_list)\n", + "\n", + "file_read('test.txt')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Write a Python program to read a file line by line store it into an array." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['readlines() is used to read all the lines at a single go and then return them as each line a string element in a list. \\n', 'This function can be used for small files, as it reads the whole file content to the memory, then split it into separate lines. \\n', \"We can iterate over the list and strip the newline '\\\\n' character using strip() function.\"]\n" + ] + } + ], + "source": [ + "def file(fname):\n", + " content_array = []\n", + " with open(fname) as f:\n", + " for text in f:\n", + " content_array.append(text)\n", + " print(content_array)\n", + "\n", + "file_read('test.txt')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Write a Python program to read a random line from a file." + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "We can iterate over the list and strip the newline '\\n' character using strip() function.\n" + ] + } + ], + "source": [ + "import random\n", + "def random_line(fname):\n", + " lines = open(fname).read().splitlines()\n", + " return random.choice(lines)\n", + "print(random_line('test.txt'))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Write a Python program to generate 26 text files named A.txt, B.txt, and so on up to Z.txt." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import string\n", + "import os\n", + "if not os.path.exists(\"test\"):\n", + " #os.path.exists() method in Python is used to check whether the specified path exists or not. \n", + " #This method can be also used to check whether the given path refers to an open file descriptor or not.\n", + " os.makedirs(\"test\")\n", + "for test in string.ascii_uppercase:\n", + " with open(test + \".txt\", \"w\") as f:\n", + " f.writelines(test)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Write a Python program to create a file where all letters of English alphabet are listed by specified number of letters on each line." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import string\n", + "def file(n):\n", + " with open(\"words1.txt\", \"w\") as f:\n", + " alphabet = string.ascii_uppercase\n", + " letters = [alphabet[i:i + n] + \"\\n\" for i in range(0, len(alphabet), n)]\n", + " f.writelines(letters)\n", + "file(3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# To scrap data from worldometer example: INDIA Data and run it on live mode.\n", + "# Print Additionally total number of Coronavirus Cases, Deaths, Recovered." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import requests\n", + "from bs4 import BeautifulSoup\n", + "url = \"https://www.worldometers.info/coronavirus/\"\n", + "page = requests.get(url) ## server sends the information in html format and that is stored in page object\n", + "page = page.text \n", + "soup = BeautifulSoup(page, \"html.parser\")\n", + "a= soup.find(\"div\" ,{\"class\": \"maincounter-number\"})\n", + "d = soup.find(\"tbody\")\n", + "d=d.text\n", + "\n", + "fp = open(\"CoronaCases.csv\",\"w\")\n", + "fp.write(d)\n", + "fp.close()" + ] + }, + { + "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 +} diff --git a/Tanya Sharma/test.txt b/Tanya Sharma/test.txt new file mode 100644 index 0000000..3ae5c4a --- /dev/null +++ b/Tanya Sharma/test.txt @@ -0,0 +1,3 @@ +readlines() is used to read all the lines at a single go and then return them as each line a string element in a list. +This function can be used for small files, as it reads the whole file content to the memory, then split it into separate lines. +We can iterate over the list and strip the newline '\n' character using strip() function. \ No newline at end of file diff --git a/Tanya Sharma/test/A.txt b/Tanya Sharma/test/A.txt new file mode 100644 index 0000000..8c7e5a6 --- /dev/null +++ b/Tanya Sharma/test/A.txt @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/Tanya Sharma/test/B.txt b/Tanya Sharma/test/B.txt new file mode 100644 index 0000000..7371f47 --- /dev/null +++ b/Tanya Sharma/test/B.txt @@ -0,0 +1 @@ +B \ No newline at end of file diff --git a/Tanya Sharma/test/C.txt b/Tanya Sharma/test/C.txt new file mode 100644 index 0000000..96d80cd --- /dev/null +++ b/Tanya Sharma/test/C.txt @@ -0,0 +1 @@ +C \ No newline at end of file diff --git a/Tanya Sharma/test/D.txt b/Tanya Sharma/test/D.txt new file mode 100644 index 0000000..02358d2 --- /dev/null +++ b/Tanya Sharma/test/D.txt @@ -0,0 +1 @@ +D \ No newline at end of file diff --git a/Tanya Sharma/test/E.txt b/Tanya Sharma/test/E.txt new file mode 100644 index 0000000..9fb75b8 --- /dev/null +++ b/Tanya Sharma/test/E.txt @@ -0,0 +1 @@ +E \ No newline at end of file diff --git a/Tanya Sharma/test/F.txt b/Tanya Sharma/test/F.txt new file mode 100644 index 0000000..c137216 --- /dev/null +++ b/Tanya Sharma/test/F.txt @@ -0,0 +1 @@ +F \ No newline at end of file diff --git a/Tanya Sharma/test/G.txt b/Tanya Sharma/test/G.txt new file mode 100644 index 0000000..4fc3fe1 --- /dev/null +++ b/Tanya Sharma/test/G.txt @@ -0,0 +1 @@ +G \ No newline at end of file diff --git a/Tanya Sharma/test/H.txt b/Tanya Sharma/test/H.txt new file mode 100644 index 0000000..8ac2eb5 --- /dev/null +++ b/Tanya Sharma/test/H.txt @@ -0,0 +1 @@ +H \ No newline at end of file diff --git a/Tanya Sharma/test/I.txt b/Tanya Sharma/test/I.txt new file mode 100644 index 0000000..b4158c4 --- /dev/null +++ b/Tanya Sharma/test/I.txt @@ -0,0 +1 @@ +I \ No newline at end of file diff --git a/Tanya Sharma/test/J.txt b/Tanya Sharma/test/J.txt new file mode 100644 index 0000000..22aac29 --- /dev/null +++ b/Tanya Sharma/test/J.txt @@ -0,0 +1 @@ +J \ No newline at end of file diff --git a/Tanya Sharma/test/K.txt b/Tanya Sharma/test/K.txt new file mode 100644 index 0000000..449e49e --- /dev/null +++ b/Tanya Sharma/test/K.txt @@ -0,0 +1 @@ +K \ No newline at end of file diff --git a/Tanya Sharma/test/L.txt b/Tanya Sharma/test/L.txt new file mode 100644 index 0000000..083b700 --- /dev/null +++ b/Tanya Sharma/test/L.txt @@ -0,0 +1 @@ +L \ No newline at end of file diff --git a/Tanya Sharma/test/M.txt b/Tanya Sharma/test/M.txt new file mode 100644 index 0000000..ef6bce1 --- /dev/null +++ b/Tanya Sharma/test/M.txt @@ -0,0 +1 @@ +M \ No newline at end of file diff --git a/Tanya Sharma/test/N.txt b/Tanya Sharma/test/N.txt new file mode 100644 index 0000000..2f94675 --- /dev/null +++ b/Tanya Sharma/test/N.txt @@ -0,0 +1 @@ +N \ No newline at end of file diff --git a/Tanya Sharma/test/O.txt b/Tanya Sharma/test/O.txt new file mode 100644 index 0000000..60a89ed --- /dev/null +++ b/Tanya Sharma/test/O.txt @@ -0,0 +1 @@ +O \ No newline at end of file diff --git a/Tanya Sharma/test/P.txt b/Tanya Sharma/test/P.txt new file mode 100644 index 0000000..675f43a --- /dev/null +++ b/Tanya Sharma/test/P.txt @@ -0,0 +1 @@ +P \ No newline at end of file diff --git a/Tanya Sharma/test/Q.txt b/Tanya Sharma/test/Q.txt new file mode 100644 index 0000000..866ad47 --- /dev/null +++ b/Tanya Sharma/test/Q.txt @@ -0,0 +1 @@ +Q \ No newline at end of file diff --git a/Tanya Sharma/test/R.txt b/Tanya Sharma/test/R.txt new file mode 100644 index 0000000..ac044e5 --- /dev/null +++ b/Tanya Sharma/test/R.txt @@ -0,0 +1 @@ +R \ No newline at end of file diff --git a/Tanya Sharma/test/S.txt b/Tanya Sharma/test/S.txt new file mode 100644 index 0000000..1db515f --- /dev/null +++ b/Tanya Sharma/test/S.txt @@ -0,0 +1 @@ +S \ No newline at end of file diff --git a/Tanya Sharma/test/T.txt b/Tanya Sharma/test/T.txt new file mode 100644 index 0000000..96583aa --- /dev/null +++ b/Tanya Sharma/test/T.txt @@ -0,0 +1 @@ +T \ No newline at end of file diff --git a/Tanya Sharma/test/U.txt b/Tanya Sharma/test/U.txt new file mode 100644 index 0000000..4f0734c --- /dev/null +++ b/Tanya Sharma/test/U.txt @@ -0,0 +1 @@ +U \ No newline at end of file diff --git a/Tanya Sharma/test/V.txt b/Tanya Sharma/test/V.txt new file mode 100644 index 0000000..d426ba8 --- /dev/null +++ b/Tanya Sharma/test/V.txt @@ -0,0 +1 @@ +V \ No newline at end of file diff --git a/Tanya Sharma/test/W.txt b/Tanya Sharma/test/W.txt new file mode 100644 index 0000000..05fdf94 --- /dev/null +++ b/Tanya Sharma/test/W.txt @@ -0,0 +1 @@ +W \ No newline at end of file diff --git a/Tanya Sharma/test/X.txt b/Tanya Sharma/test/X.txt new file mode 100644 index 0000000..500c070 --- /dev/null +++ b/Tanya Sharma/test/X.txt @@ -0,0 +1 @@ +X \ No newline at end of file diff --git a/Tanya Sharma/test/Y.txt b/Tanya Sharma/test/Y.txt new file mode 100644 index 0000000..24de910 --- /dev/null +++ b/Tanya Sharma/test/Y.txt @@ -0,0 +1 @@ +Y \ No newline at end of file diff --git a/Tanya Sharma/test/Z.txt b/Tanya Sharma/test/Z.txt new file mode 100644 index 0000000..0f13712 --- /dev/null +++ b/Tanya Sharma/test/Z.txt @@ -0,0 +1 @@ +Z \ No newline at end of file diff --git a/Tanya Sharma/words1.txt b/Tanya Sharma/words1.txt new file mode 100644 index 0000000..3073342 --- /dev/null +++ b/Tanya Sharma/words1.txt @@ -0,0 +1,9 @@ +ABC +DEF +GHI +JKL +MNO +PQR +STU +VWX +YZ From ae806b8a68960884a34873a70a2da73691c71b74 Mon Sep 17 00:00:00 2001 From: Tanya581 <63255109+Tanya581@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:26:40 +0530 Subject: [PATCH 27/27] Delete linux assignment 1 and 2.txt --- Tanya Sharma/linux assignment 1 and 2.txt | 47 ----------------------- 1 file changed, 47 deletions(-) delete mode 100644 Tanya Sharma/linux assignment 1 and 2.txt diff --git a/Tanya Sharma/linux assignment 1 and 2.txt b/Tanya Sharma/linux assignment 1 and 2.txt deleted file mode 100644 index fd69c13..0000000 --- a/Tanya Sharma/linux assignment 1 and 2.txt +++ /dev/null @@ -1,47 +0,0 @@ -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 doesnt 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 shells 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 users UID, using the id command: - - - id -u username - 1345 - -6. 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. - -7. 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 -