Skip to content

This is my Artificial Intelligence Lab 2 Working.

Notifications You must be signed in to change notification settings

DaudAhmad0303/AI-Lab-2

Repository files navigation

Lab Manual

Write a Python program to find those numbers which are divisible by 7 and multiple of 5, between 1500 and 2700 (both included).

Write a Python program to convert temperatures to and from celsius, fahrenheit.

Formula :

C = (F - 32) * (5 / 9)
F = (9 / 5 ) * C + 32

[ where C = temperature in celsius and F = temperature in fahrenheit ]

Expected Output :

60°C is 140 in Fahrenheit
45°F is 7 in Celsius

Write a Python program to guess a number between 1 to 9.

Note : User is prompted to enter a guess. If the user guesses wrong then the prompt appears again until the guess is correct, on successful guess, user will get a "Well guessed!" message, and the program will exit.

Write a Python program to construct the following pattern, using a nested for loop.

*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*

Write a Python program that accepts a word from the user and reverse it.

Write a Python program to count the number of even and odd numbers from a series of numbers.

Sample numbers :

numbers = (1, 2, 3, 4, 5, 6, 7, 8, 9)

Expected Output :

Number of even numbers : 5
Number of odd numbers : 4

Write a Python program that prints each item and its corresponding type from the following list.

Sample List :

datalist = [1452, 11.23, 1+2j, True, 'w3resource', (0, -1), [5, 12], {"class":'V', "section":'A'}]

Write a Python program that prints all the numbers from 0 to 6 except 3 and 6.

Note : Use continue statement.

Expected Output :

0 1 2 4 5

Write a Python program to get the Fibonacci series between 0 to 50.

Note : The Fibonacci Sequence is the series of numbers : 0, 1, 1, 2, 3, 5, 8, 13, 21, .... Every next number is found by adding up the two numbers before it.

Expected Output :

1 1 2 3 5 8 13 21 34

Write a Python program which iterates the integers from 1 to 50. For multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".

Sample Output :

FizzBuzz
1
2
Fizz
4
Buzz

Write a Python program which takes two digits m (row) and n (column) as input and generates a two-dimensional array. The element value in the i-th row and j-th column of the array should be i*j.

Note :

i = 0,1.., m-1

j = 0,1, n-1.

Test Data :

Rows = 3
Columns = 4

Expected Result :

[[0, 0, 0, 0], [0, 1, 2, 3], [0, 2, 4, 6]]

Write a Python program that accepts a sequence of lines (blank line to terminate) as input and prints the lines as output (all characters in lower case).

Write a Python program which accepts a sequence of comma separated 4 digit binary numbers as its input and print the numbers that are divisible by 5 in a comma separated sequence.

Sample Data :

0100,0011,1010,1001,1100,1001

Expected Output :

1010

Write a Python program that accepts a string and calculate the number of digits and letters.

Sample Data :

Python 3.2

Expected Output :

Letters: 6
Digits: 2

Write a Python program to check the validity of password input by users.

Validation :

  • At least 1 letter between [a-z] and 1 letter between [A-Z].
  • At least 1 number between [0-9].
  • At least 1 character from [$#@].
  • Minimum length 6 characters.
  • Maximum length 16 characters.

Releases

No releases published

Packages

No packages published

Languages