Compute the value of AFD416-BECE16+67758 using signed magnitude representation
Question 1:
write a program to find the given string in the root directory that contains a text file
1. In a recursive manner (case in sensitive )
2. only in the root directory
use command line arguments.
program_name -ri string root_dir (recursive)
program_name -si string root_dir (root director )
The output which file and line contains the string
Question 1:
Finder program
# Dict, list, queue
# directory --- os.walk()
list1 = [c:, d:, e:]
dict1 = {}
def func(drive)
resp = os.walk(drive)
statem1
st
dict1[file] = path
for drive in list1:
#th1 = Thread(target= func(drive))
#th1.start()
func(drive)
# apply join
finding total time of execution #
dict ---> pickle
Question 1:
How to make object as callable video __call__
from collections import Counter
class MyCounter(Counter):
Add here required code so that we can give data to object like co1("intel")
co1 = MyCounter()
co1("intel")
In this task, you need to understand two algorithms which can be helpful, the BreadthFirst Search which utilizes the Queue data structure to find the shortest path and the
Depth-First Search which can traverse a Stack data structures.
Hint:
Develop a data structure similar to binary trees. Using a standard 8 X 8 chessboard, show
the knight’s movements in a game. As you may know, a knight’s basic move in chess is
two forward steps and one sidestep. Facing in any direction and given enough turns, it
can move from any square on the board to any other square.
If you want to know the simplest way your knight can move from one square (or node) to
another in a two-dimensional setup, you will first have to build a function like the one
below.
knight plays ([0,0], [1,2]) == [[0,0], [1,2]]
knight plays ([0,0], [3,3]) == [[0,0], [1,2], [3,3]]
knight plays ([3,3], [0,0]) == [[3,3], [1,2], [0,0]]
Find the length of the following strings
char str1[] = "I love C+++ Programming! ";
char str2[] = "This is so cool!";
char str3[] = "Good job learner!";
The output should be like the following format:
The length of str1 is __
The length of str2 is __
The length of str3 is __
Given
rows = 4
cols = 3
matrix = 1 2 3
4 5 6
7 8 9
10 11 12
output : 1 2 3 6 5 4 7 8 9 12 11 10
Explination : Every alternative row should be in reverse order.