Skip to content

Commit

Permalink
Documentaion For Some Codes aare Updated
Browse files Browse the repository at this point in the history
Documentaion For Some Codes  aare Updated with some comment for better Code-Reading.
  • Loading branch information
codeperfectplus committed Jan 28, 2020
1 parent 432f747 commit 5514bd9
Show file tree
Hide file tree
Showing 21 changed files with 135 additions and 86 deletions.
4 changes: 3 additions & 1 deletion Control Flow/Loop 3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"""
Created on Mon Oct 28 17:17:30 2019
@author: Looping Example 2
@author: codePerfectPlus
Looping Example 2
"""

Phone = ['Iphone 10', 'Samsung S10', 'One plus 7 pro', 'Redmi note 7 pro']
Expand Down
10 changes: 6 additions & 4 deletions Functions/Basic Function Introduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
'''

def check_number(x):
if (x % 2 == 0):
print("Given Number Is Even")
if (x % 2 == 0): # checking Divisibility by 2
print("Given Number Is Even") # 2,4,6,8....

else:
print("Given Number Is Odd")
print("Given Number Is Odd") #1,3,5,7...

check_number(7)
check_number(5)
Expand All @@ -21,4 +21,6 @@ def check_number(x):
def student_name(firstname,lastname):
print(firstname, lastname)

student_name(firstname = 'Alex', lastname = 'Jean')

student_name("john","adam")
student_name(lastname = 'Jean',firstname = 'Alex',)
9 changes: 7 additions & 2 deletions Functions/Function_extended.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
'''
Check you name contain vowel Or Not Using python intersection function.
'''

def names():
name = str(input("Please! Enter Your Name"))
name = input("Please! Enter Your Name\n") #Enter Your name

if set('aeiou').intersection(name.lower()):
print("Your Name Contains a vowel")
else :
print("Your Name doesn't have a vowel")

for letter in names:
for letter in name: # For Loop To Check Letter
print(letter)


names()
1 change: 1 addition & 0 deletions Numpy/Basic Operation_numpy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'''
@author : CodePerfectplus
we can use arithmatic operators to do elementwise operation on array to convert in a new array.
Arithmatic Operaqtors
Expand Down
13 changes: 13 additions & 0 deletions Numpy/std Deviation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'''
Standard deviation is a number that describes how spread out the values are.
A low standard deviation means that most of the numbers are close to the mean (average) value.
A high standard deviation means that the values are spread out over a wider range.
Example: This time we have registered the speed of 7 cars:
'''
import numpy

speed = [86,87,88,86,87,85,86]

x = numpy.std(speed)

print(x)
7 changes: 5 additions & 2 deletions Pandas/Create Pandas Dataframe.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# import pandas Library

'''
import pandas Library
Pandas is Python Library for dataframe, Like to read write and load data in dataframe.
Pandas is must known library for Data Science.
'''
import numpy as np
import pandas as pd

Expand Down
3 changes: 2 additions & 1 deletion Pandas/Pandas Indexing and slicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"""
Created on Wed Oct 23 17:42:13 2019
@author: Indexing and Selecting Data with Pandas
@author: CodePerfectPlus
@Topic : Indexing and Selecting Data with Pandas
"""
import pandas as pd
df = pd.read_csv('nba.csv', index_col = "Name")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
Cretae Data Frame Using Dictionary in python.
Dictionary is a (key-value) Pair Data Type in python.
'''

import pandas as pd

dict ={ 'Name':['john', 'joe', 'Alex', 'Iris', 'berry'],
Expand Down
Empty file.
8 changes: 4 additions & 4 deletions Python Projects/Find n-th Fiboncci Number.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# a = (a-1) + (a-2)

# recurssion mehthod

'''
Fibonacci Series start from 1. it makes new number by adding previous 2 Numbers.
1,1,2,3,5
'''
def Fibonacci(n):
if n<0:
print("Wrong Input ! Please Check Again")
Expand Down
2 changes: 2 additions & 0 deletions Python Projects/Google Image Auto Image Download.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# importing google_images_download module
'''
Python Module for download google image in one click by User Input'''
from google_images_download import google_images_download

# creating object
Expand Down
11 changes: 0 additions & 11 deletions Python Projects/Grade Calculator.py

This file was deleted.

26 changes: 19 additions & 7 deletions Python Projects/Number Guessing Game .py
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
import random
start = input("First Choose your Range for Number guessing\nlike 1 to 20\nEnter To Start Game For Number Guess ")
'''
Number Guessing Game In Python Without Gui Using Random and User_Input Fucntion in Python 3.8
'''
import random
input("First Choose your Range for Number guessing\nlike 1 to 20\nEnter To Start Game For Number Guess ")
lower_range =int(input("Enter Your Lower Range To Start Guessing Game: \n"))
upper_range =int(input("Enter Your Upper Range To Start Guessing Game: \n"))
for i in range(10):
ran_num = random.randint(lower_range,upper_range)

ran_num = random.randint(lower_range,upper_range)
#print(ran_num) To print Random Number For Debugging Purpose.
'''
Random : import random for generate random number between Lower Range TO Upper Range
Input : input Fucntion for take user input
Lower Range : Lower Range for randomly Generated Number
Upper Range : Upper Range For Randomly Generated Number
ran_num = Random Number Generated In Saved In ran_num Variable for Check With User Input
'''

num = int(input("Please Enter Your Guess Number :\n"))
while True:
if num == ran_num:
if num == ran_num: # Checking User Input with Random Generated Number
print("You Guess Right Number")
break
else:
print("Your Guess Was Wrong")
print("Your Guess Was Wrong") # if ran_num was not same as User Input.
break
print("The Real Number Was {}".format (ran_num))
print("The Real Number Was {}".format (ran_num)) # To Print The Random Generated Number .
20 changes: 14 additions & 6 deletions Python Projects/Prime Number.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
'''A Prime Number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
The first few prime number are {2,3,5,7,11}
'''

a = 1
b = 30

input("Enter Your Range For Print Number \nLower Range \n Upper Range\n Like 1 to 20")
a = int(input("Lower Range :\n "))
b = int(input("Upper Range :\n "))
solution =[]
'''
a = Lower Range
b = Upper Range
solution = a list to contain prime Number
'''
print("-"*20)
for val in range(a, b + 1):
if val >1:
for n in range(2, val):
for n in range(2, int(val**0.5)):
if ( val % n) == 0:
break

else:
print(val)
solution.append(val)

print(solution)
10 changes: 7 additions & 3 deletions Python Projects/Python Program for factorial.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
'''
Python program to find factorial of given number
Factorial of n
n = n*(n-1)*(n-2)*(n-3).......3*2*1
4 = 4*3*2*1 = 24
'''
def factorial(n):
#Line to Find Factorial
return 1 if (n==1 or n==0) else n * factorial(n -1);

#Driver Code
num = 5;
print("Factorial of ",num,"is",
factorial(num))
num = int(input(" Enter Number For Factorial :\n"))
answer = factorial(num)
print(f"Factorial of {num} is {answer}.")
14 changes: 0 additions & 14 deletions Python Projects/Rock Paper Scissors.py

This file was deleted.

1 change: 1 addition & 0 deletions Python Projects/Text To Speech.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'''
python programfor convert text to speech
gTTS = Google Text to Speech
'''
from gtts import gTTS
import os
Expand Down
5 changes: 4 additions & 1 deletion Python Projects/Text to speech using windows in feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@

import win32com.client as wincl
speak = wincl.Dispatch("SAPI.SpVoice")
speak.Speak("Text To Speech")
speak.Speak("Text To Speech")
'''
This Program is not complete yet
'''
23 changes: 18 additions & 5 deletions Python Projects/password Generator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
'''
Password Generation Using Random Function in Python.
Random is python module to generate random value or select random vlaue from list, string.
'''
import random
list = []

s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()?"
passlen = int(input("Enter Length to Genrate Password:\n"))
if passlen<6:
print("Choose 6 or Greater")
else:
p = "".join(random.sample(s,passlen ))
print (p)
n = int(input("How Many Password Your Want to print :\n"))
'''
passlen = Length of password . Password Length should be greater than 8
n = Number of password for your project
s = symbol and letter for auto-generation password
'''
for i in range(n):
if passlen<8:
print("Choose 8 or Greater")
else:
p = "".join(random.sample(s,passlen))
list.append(p) # append Password in list
print(list)
32 changes: 19 additions & 13 deletions Python Projects/reverse palindrome.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
'''
python programe to check if a string is palindrome
or not'''
Python Programe To Check if a String is Palindrome or Not
'''

x = "211112"
w = ""
check1 = input("Choose Your Input For Check Palindrome\n For Integer Type --> i \n For Word Type -->s\n").lower()
for i range(1,3):
if check1 == 's':
x = input("Enter Your Word Here :\n").lower()
elif check1 == 'i':
x = input("Enter Your Number Here :\n")
else:
print("Please Enter I or S only")

# save string x to a new new variable and compare them
for i in x:
w = i + w
#print(w)
if (x==w):
print("Yes")
break
w = "" # Empty String to save Reverse value in it.

else:
print("No")
#save string x to a new new variable and compare them
for i in x:
w = i + w # save new value to w
if (x==w):
print("Yes")
break
else:
print("No")
17 changes: 5 additions & 12 deletions Python Projects/sum of square of n natural number.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
'''
Given a positive integer N. The task is to find 12 + 22 + 32 + ….. + N2.
if N = 4
1^2 + 2^2 + 3^2 + 4^2
The idea is to run a loop from 1 to n and for each i, 1 <= i <= n, find i2 to sum.
1^2 + 2^2 + 3^2 + 4^2 = 30
The idea is to run a loop from 1 to n and for each i, 1 <= i <= n, find i2 to sum.
'''

def squaresum(n):

sum = 0
for i in range(1, n+1):
sum = sum + (i * i)

sum += (i * i)
return sum

n = 4
print(squaresum(n))

n = int(input("Enter Number to Print Sum Of square of N Natural Number :\n"))
print(squaresum(n))

0 comments on commit 5514bd9

Please sign in to comment.