






























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
"AI" redirects here. For other uses, see AI (disambiguation), Artificial intelligence (disambiguation), and Intelligent agent. Part of a series on Artificial intelligence Artificial intelligence prompt completion by dalle mini.jpg Major goals Approaches Philosophy History Technology Glossary vte Artificial intelligence (AI) is intelligence—perceiving, synthesizing, and inferring information—demonstrated by machines, as opposed to intelligence displayed by humans or by other animals. Example tasks in which this is done include speech recognition, computer vision, translation between (natural) languages, as well as other mappings of inputs.[1] AI applications include advanced web search engines (e.g., Google Search), recommendation systems (used by YouTube, Amazon, and Netflix), understanding human speech (such as Siri and Alexa), self-driving cars (e.g., Waymo), generative or creative tools (ChatGPT and AI art), automated decision-making, and competing at the highest level in strategic
Typology: Thesis
1 / 38
This page cannot be seen from the preview
Don't miss anything!
Subject code:- UGCA
S.No Program Page No. Date Remarks
x = 40 y = 12 add = x + y sub = x - y pro = x * y div = x / y print(add) print(sub) print(pro) print(div)
num = 29
#num = int(input("Enter a number: "))
variable flag = False
1 ifnum> 1:
fori in range(2, num): if (num % i) == 0:
flag = True
break
if flag: print(num, "is not a prime number") else: print(num, "is a prime number")
Output2:- Output3:-
#Initialize array arr = [25, 11, 7, 75, 56]; #Initialize max with first element of array. max = arr[0]; #Loop through the array fori in range(0, len(arr)): #Compare elements of array with max if(arr[i] > max): max = arr[i];
#Initialize array arr = [1, 2, 3, 4, 5]; sum = 0; #Loop through the array to calculate sum of elements fori in range(0, len(arr)): sum = sum + arr[i];
#Initialize array arr = [5, 2, 8, 7, 1]; temp = 0; #Displaying elements of original array print("Elements of original array: "); fori in range(0, len(arr)): print(arr[i], end=" "); #Sort the array in ascending order fori in range(0, len(arr)): for j in range(i+1, len(arr)): if(arr[i] >arr[j]): temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; print(); #Displaying elements of the array after sorting print("Elements of array sorted in ascending order: "); fori in range(0, len(arr)):
def test(nums): return nums.count(19) == 2 and nums.count(5) >= 3 nums = [19,19,15,5,3,5,5,2] print("Original list:") print(nums) print("Check two occurrences of nineteen and at least three occurrences of five in the said list:") print(test(nums)) nums = [19,15,15,5,3,3,5,2] print("\nOriginal list:") print(nums) print("Check two occurrences of nineteen and at least three occurrences of five in the said list:") print(test(nums)) nums = [19,19,5,5,5,5,5] print("\nOriginal list:") print(nums) print("Check two occurrences of nineteen and at least three occurrences of five in the said list:") print(test(nums))
class Tree: def init (self, val=None): if val != None: self.val = val else: self.val = None self.left = None self.right = None tree = Tree(20) tree.left = Tree(18) tree.right = Tree(22) print(tree.left.val) print(tree.right.val)
Ans.Uninformed Search Algorithms: The search algorithms in this section have no additional information on the goalnode other than the one provided in the problem definition. The plans to reach thegoal state from the start state differ only by the order and/or length of actions. Uninformed search is also called Blind search. The following uninformed search algorithms are discussed in this section.
list graph = { 'A' : ['B','C'], 'B' : ['D', 'E'], 'C' : ['F'], 'D' : [], 'E' : ['F'], 'F' : [] } visited = set() # Set to keep track of visited nodes. defdfs(visited, graph, node): if node not in visited: print (node) visited.add(node) for neighbour in graph[node]: dfs(visited, graph, neighbour) # Driver Code Program:
Breadth-first search (BFS) IT is an algorithm used for tree traversal on graphs or tree data structures. BFS can be easily implemented using recursion and data structures like dictionaries and lists. The Algorithm
graph = { 'A' : ['B','C'], 'B' : ['D', 'E'], 'C' : ['F'], 'D' : [], 'E' : ['F'], 'F' : [] } visited = [] # List to keep track of visited nodes. queue = [] #Initialize a queue defbfs(visited, graph, node): visited.append(node) queue.append(node) while queue: s = queue.pop(0) print (s, end = " ") for neighbour in graph[s]: if neighbour not in visited: visited.append(neighbour) Program:-