Aim : Algorithm to convert temperature from Fahrenheit
to celsius
Step 1: Start.
Step 2: Read F.
Step 3: C=(5(F-32))/9.
Step 4: Print C.
Step 5: Stop
Aim : Algorithm to convert temperature from Celsius to
Fahrenheit:
Step 1: Start
Step 2: Read the value of temperature to be converted from the user
Step 3: Assign the value to a variable, say ‘cel’
Step 4: Initialize f = 0
Step 5: f = ((5/9) * cel ) + 32
Step 6: Display f
Step 7: Stop
Aim : Alogorithm to construct the following pattern using
nested loop: *
***
*****
*******
step1: Start
step2: Read number num
step3: [initialize]
r=1
step4: Repeat step 4 through 10 until
num>=r
step5: [initialize]
c=1
step6: Repeat step 6 through 8 until c<=r step7: print */#
step8: c=c+1
[end of loop step6]
step9: go to next line
step10: r=r+1
[end of loop step4]
step11: stop
Aim : Algorithm to Find Prime Number Program
STEP 1: Take num as input.
STEP 2: Initialize a variable temp to 0.
STEP 3: Iterate a “for” loop from 2 to num/2.
STEP 4: If num is divisible by loop iterator, then increment temp.
STEP 5: If the temp is equal to 0,
Return “Num IS PRIME”.
Else,
Return “Num IS NOT PRIME”.
Aim : Algorithm to find factorial of the given number
using a recursive function
Step 1: Start
Step 2: Read number n
Step 3: Call factorial(n)
Step 4: Print factorial f
Step 5: Stop
Factorial(n)
Step 1: If n==1: then return 1
Step 2: Else
f=n*factorial(n-1)
Step 3: Return f
Aim : Algorithm to count the number of even and odd
numbers from an array of N numbers.
Step 1: Start
Step 2: [ Take Input ] Read: Number
Step 3: Check: If Number%2 == 0 Then
Print : N is an Even Number.
Else
Print : N is an Odd Number.
Step 4: Exit
Aim : Algorithm to reverse a string word by word.
Step 1: Initialize an empty string reversed_string.
Step 2: Loop through each character of the original string.
Step 3: Append the character at the beginning of reversed_string.
Step 4: Return the reversed_string.
Aim : Algorithm to get a tuple and a list as input, and to
count the occurences of all items of list in the tuple.
Step 1: Start
Step 2: Create a tuple
Step3: Add elements into tuple using iteration
Step4: Display the elements in tuple
Step 5: Create a list
Step 6: Add elements into list using iteration
Step 7: Display the elements in list
Step 8: Initialize count = 0
Step 9: Check one by one element in Tuple and list matches
Step 10: If match found increment the count
Step 11: Display Count
Step 12: Stop
Aim : Algorithm of Tower Of Hanoi using Recursion.
There are following three rules to be followed while solving tower of hanoi algorithm:
1. We can move only one disk at a time.
2. A disk can only be moved if it's the topmost one on a stack.
3. No disk should be placed at the top of the smaller disk which means that the disk of
larger diameter cannot be placed on a disk of smaller diameter.
Utilize recursion to transfer disks from the source rod to the destination rod via a helper rod.
step 1: Move 'N-1' disks from the source rod(A) to the auxiliary rod(B), using the
destination rod (C) as the helper.
step 2: Move the last disk from the source rod(A) to the destination(C) rod directly.
step 3: Move the 'N-1' disks from the auxiliary rod(B) to the destination rod(C), using
the source rod(A) as the helper.
Aim : Algorithm for Guessing the Number game.
Step 1: A random number is picked by the computer.
Step 2: A user is asked to make a first guess.
Step 3: The user’s guess is matched with the random number picked by
the computer.
Step 4: If the match is there, then you will get to see, “You got it right in
___ tries.”
Step 5: If the number is not matched, the computer tells you that the
number the user wrote is higher or lower than the number chosen by it.
Step 6: Looking at the scenario again, the user will make a guess and write
the number down.
Step 7: Steps 3-6 are repeated until 6 tries or the correct number is
guessed (whatever comes first).
Step 8: If you guess the correct number before 6 tries, you will get to see,
“You got it right in _____ tries.”
Step 9: If you didn’t get the number in 6 guesses, you will get “You did not
get the number in 6 guesses. My number was _____. “
Step 10: .In the end, it will ask you if you would like to Play again and then
display a thank you note.
Aim : Algorithm for Dictionary with words and their
meanings.
Step 1: Start at the beginning of the dictionary.
Step 2: Compare the word you are looking for with the current word
in the dictionary.
Step 3: If the current word matches the word you are looking for, you
have found it!
Step 4: If the current word comes after the word you are looking for
alphabetically, the word is not in the dictionary.
Aim : Algorithm to design a simple GUI using Tkinter.
Step 1. Start.
Step 2. Define a function show_message_box() that shows a
message box with a
message.
Step 3. Create the main window.
Step 4. Create a button in the window:
4.1 Set button text to "Click me".
4.2 Link the button to show_message_box() function.
Step 5. Display the button in the window.
Step 6. Run the Tkinter main loop to keep the window open.
Step 7. End.
Aim : To write a Python program that accesses the
Facebook Messenger API and retrieves message data.
Step 1 : Start
Step 2 : Import facebook module.
Step 3 : Open the Facebook account and create a Facebook page.
Step 4 : Create a Facebook app and generate the access token with
appropriate permissions.
Step 5 : Create a Graph API object using the access token.
Step 6 : Print the retrieved message from Facebook using the
Graph API object with Facebook page id and object id passed as
arguments.
Step 7 : Stop
Aim : To write a Python program that utilizes the
Openweather API to get current weather information.
Step 1 : Start
Step 2 : Import requests module.
Step 3 : Login to http://api.openweathermap.org and generate an API key.
Step 4 : Define the function get_current_weather(city)
Step 5 : Frame the url as
http://api.openweathermap.org/data/2.5/weather?q={city}&appid={API_KEY}&units
=metric
Step 6 : Create a response object using the get method of requests module.
Step 7 : If the response code is 200, print the weather information of the city using json
object.
Step 8 : Get the name of the city as input and call the function get_current_weather(city).
Step 9 : Stop
Aim : To write a Python program that uses a dataset
and analyzes the operations including filtering and
grouping using pandas module.
Step 1 : Start
Step 2 : Import pandas module.
Step 3 : Call the read_csv method to read the data from the dataset sales_data.csv.
Step 4 : Print the header data, summary statistics, filtering, grouping and sorted data using
appropriate function calls.
Step 5 : Stop
Aim : To write a Python program to perform numerical
operations on arrays using numpy module.
Step 1 : Start
Step 2 : Import numpy module.
Step 3 : Create two arrays arr1 and arr2.
Step 4 : Print the arrays and the results of the basic operations – addition, subtraction,
multiplication and division.
Step 5 : Print the square root and mean of elements in arr1.
Step 6 : Print the maximum element and the sum of elements in arr2.
Step 7 : Create another array arr3. Print the array arr3 and the reshaped array.
Step 8 : Stop
Aim : To write a Python program for data visualization
by creating meaningful plots from a dataset using
matplotlib and seaborn modules.
Step 1 : Start
Step 2 : Import seaborn, pandas and pyplot from matplotlib modules.
Step 3 : Load the tips dataset using load_dataset function.
Step 4 : Set the parameters for scatter, bar, box and histogram charts.
Step 5 : Display these charts using the show function.
Step 6 : Stop