Module 1 ICP 2: Loops, List, Tuples, Functions in python - acikgozmehmet/PythonDeepLearning GitHub Wiki
Objectives:
The following topics are covered.
- loops: for and while statements.
- Interactive loop and sentinel loop: implementations using while statement
- Nested loop
- Reading from a file in loop
- Tuples
- Set
- dictionaries
- Use case
Overview
- Working with for loops
- Working with Tuples, Lists, Functions
- Various kinds of Loops: definite and indefinite loops, using files in loops, Nested Loops
In Class Programming
• 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 and
-
List comprehensions
N: No of students (Read input from user)
Ex: L1: [150,155, 145, 148]
Output : [68.03, 70.3, 65.77, 67.13]
Click here to get the source code
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
Click here to get the source code
3. Write a python program to find the wordcount 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
Click here to get the source code
References
https://github.com/wade12/ProgrammingForBigDataCA2CarRental/blob/master/carRentalApp.py
http://www.w3resource.com/python-exercises/python-conditional-statements-and-loop-exercises.php