ICP 2 - Saiaishwaryapuppala/CSEE5590_python_Icp GitHub Wiki

Python and Deep Learning: Special Topics

Rajeshwari Sai Aishwarya Puppala

Student ID: 16298162

Class ID: 35

In class programming:2

Objectives

1.Write a program, which reads weights (lbs.) of N students into a list and convert these weights to kilograms in a separate list using:

Loops

List comprehensions

N: No of students (Read input from the user)

Ex: L1: [150,155, 145, 148]

Output: [68.03, 70.3, 65.77, 67.13]

2.Write a program that returns every other char of a given string starting with first using a function named

“string_alternative”

Str = “Good evening”

Output: Go vnn Note: You need to create a function named “string_alternative” for this program and call it from the main function.

3.Write a python program to find the word count in a file for each line and then print the output. Finally, store the output back to the file.

Input: A file includes two line

Python Course

Deep Learning Course

Output: Python: 1 Course: 2 Deep: 1 Learning: 1

Note: Your program should work for any number of lines.

Converting LBS to KGS

Code

  • Take the number of weights "n" from user
  • Take the LBS values and store in a list
  • Convert the LBS to KGS

Output:

Finding String Alternatives

Code

  1. Take the sentence from the user
  2. Send the sentence to string_alternative function
  3. Take all the alternative characters from the sentence and send it to the main function
  4. Print the sentence which contains the string alternatives

Output:

Finding Word Count

Code

  • Create a folder to store the input text file and output text file.
  • Read the text from the file(path is given the help of pathlib ) which has "N" number of lines
  • The words are counted with the help of counter from collection package
  • Now write the words with word count in an output file

Output:

Input Text File:

Output Text File: