Philip-Leron / internship

0 stars 0 forks source link

TASK2: BEGINNER'S GUIDE TO PYTHON #2

Open philusnarh opened 6 years ago

philusnarh commented 6 years ago

Lexical Conventions and Syntax Basic syntax Variables Operators Division and Type Conversion Augmented Assignment Namespaces

Data types Numbers Strings String manipulation String operations String methods

Lists List notation List creation shortcuts Operations on lists List Attributes Combining lists list slices Comparing lists Sorting lists List methods

Dictionaries Dictionary notation Operations on Dictionaries Combining two Dictionaries Deleting from dictionary

Sets Constructing Sets Membership Testing Removing Items Iteration Over Sets Set Operations

Flow control Loops ( For, While, Breaking, continue, else) Branches

Functions Function calls Defining functions Declaring Arguments Default Argument Values Variable-Length Argument Lists Closure lambda Scoping

philusnarh commented 6 years ago

Try the following Python Basic exercises::

  1. Write a Python program to print the following string in a specific format.

Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are" Output :

Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high,
Like a diamond in the sky. Twinkle, twinkle, little star, How I wonder what you are

  1. Write a Python program which accepts the user's first and last name and print them in reverse order with a space between them.

  2. Write a Python program to get the volume of a sphere with radius 6.

  3. Write a Python program to test whether a number is within 100 of 1000 or 2000.

  4. Write a Python program to find whether a given number (accept from the user) is even or odd, print out an appropriate message to the user.

  5. Write a Python program to test whether a passed letter is a vowel or not.

philusnarh commented 6 years ago

How to handle Arrays and make plots

http://cs231n.github.io/python-numpy-tutorial/

https://engineering.ucsb.edu/~shell/che210d/numpy.pdf

philusnarh commented 6 years ago

import numpy as np check = np.zeros((9, 9)) check[::2, 1::2] = 1 check[1::2, ::2] = 1 import matplotlib.pyplot as plt plt.imshow(check, cmap='gray', interpolation='nearest')

philusnarh commented 6 years ago

%load_ext autoreload %autoreload 2 import matplotlib.pyplot as plt %matplotlib inline