ICP 1 - awais546/Python-and-Deep-Learning GitHub Wiki

Python and Deep Learning

Introduction

In the first ICP we did some basic introduction of python and its basic functions. Some basic source code for reference was given having the basic examples of print, arithmetic operations and loops etc. The ICP consists of three questions which are as follows.

  1. State the difference between Python 2 and Python 3 version.
  2. Write a python program for the following: Input the string "Pythong" as a list of characters from console, delete at least 2 characters, reverse the resultant string and print it. Take two number from ser and perform arithmetic operations on them.
  3. Write a program that accepts a sentence and replace each occurrence of "python" with "pythons" without using regex.

Solution

Question 1:

The following screenshot shows the difference between python version 2.x and python 3.x.

Question 2:

This question consists of two functions. The first function takes a list of characters. Deletes any two characters and reverse the resultant string. It is shown as follows.

The result of the function is given below

The second function consists of arithmetic operations like additions, subtraction, multiplication etc. The function takes two numbers and returns the output as follows. The function is given below.

The result is given below.

Question 3:

This question contains a function that takes three arguments, a string, the original word to be replaced and the word to be replaced with. The function is given below.

The result is given below.

Conclusion

To conclude this ICP we can say that the questions focuses all the basic concepts of python which will be used in the upcoming ICPs for advance programming.