Python Programming Basic
Course Content
Slides
Slides
Exercise of Variables
# Write a python program, create variables with literals of
# int, float, string, boolean
#print the type of each variable
# print the value of each variable
# print the value of each
variable in a sentence
# Note: Please use Camel Case or Pascal Case
Exercise of Conditional Statement
# Task 1
# Write a python program to display students grade
# First ask user score using input method
# Check if user score above 90, print your grade is A
# Check if user score above 75, print your grade is B
# Check if user score above 65, print your grade is C
# Check if user score below 40, print your grade is Fail
Slides
Exercise of Loops
Q1. Write a program to print multiplication table of a given number(accept number from
user)
eg. if user input 3
3 x 1 = 3
3 x 2 = 6 and so on
Q2. Accept 10 numbers from user and display average of it.
Q3. Write a program to display numbers which is divisible by only 11 from 100 to 300.
Note: If you wish to practice more questions, please proceed.
Slides
Exercise Coming Soon!
Slides
Practice Question
Q1. Develop a game where the computer randomly selects a number within a specified range,
and the user has to guess the number.
Provide hints if the guessed number is too high or too low.
After user guess correct number display guess attempts and the exact answer too.
Make sure user does not input other than integer, if its other data type show them invalid
input.
Hint: Use while loop, generate random number use python random.randint() function
Write a Python function that accepts a string and counts the number of upper and lower case
letters.
Sample String : 'The quick Brow Fox'
Expected Output :
No. of Upper case characters: 3
No. of Lower case Characters : 12
Note: If you can take string input from user you can do it .
Install
Use jyupter notebook locally
Install notebook
pip install notebook
To run notebook
jupyter notebook
Run basic numpy
import numpy as np
arr = np.array([1, 2, 3, 4, 5])
print(arr)