Saturday 12 February 2022
Python practice programs for beginners - Day 16
Day 15 Solution:
Friday 11 February 2022
Python practice programs for beginners - Day 15
Thursday 10 February 2022
Python practice programs for beginners - Day 14
Day 13 Solution:
Python Grade Checker Project Source Code:
Day 14: for loop
Syntax:
for val in sequence:
statements to be expected in the loop
val - variables
sequence - may be a range or list of items
Example:
Output:Task: Print your name 10 times
Wednesday 9 February 2022
Python practice programs for beginners - Day 13
Day 12 Solution:
Get a student details such as:
Name:
School/College:
City:
Subject 1 mark :
to
Subject 5 mark:
Then calculate the following details and display them:
Total:
Average:
Pass/Fail:
Grade:
Grade Calculation based on Average value:
91 to 100 - A+
86 - 90 - A
80 - 85 - B+
79 - 84 - B
70 - 78 - C
60 - 69 - D
50 - 58 - E
Below 50 - F
Sample Output:
Will see the solution in the next post.
Tuesday 8 February 2022
Python practice programs for beginners - Day 12
Day 11 solution:
We can use
f --> format
' --> single apostrophe used to say that it follows String formatting.
{} --> we can use the curly braces for the placeholders where we can mention the variable name.
Monday 7 February 2022
Python practice programs for beginners - Day 11
Day 10 Solution:
Day 11: If elif
If we want to check more scenarios we can use if elif
Syntax:
if condition 1:
Statement to be executed if the condition is True
elif condition 2:
Statement to be executed if the condition is True
elif condition 3:
Statement to be executed if the condition is True
Day 11 Task: Get three numbers from the user and try to find the smallest of those three numbers.
Python practice programs for beginners - Day 10
Day 9 Solution:
Day 10: If-Else statement
In the above, we have used two if statements but we can reduce the number of lines of code by using an else statement.
You can see the number of lines of code decreased.
The If else get applied in many scenarios.
Day 10 Task:
Get a number from the user and find whether the given number is an odd number or an even number.
Python practice programs for beginners - Day9
Day 8 solution:
Python practice programs for beginners - Day8
Day 7 Solutions:
and Operator:
Example:
a=10
b=10
c=10
a==b and a==c --> True
(True) and (True) --> True
a=11
b=10
c=10
a==b and a==c --> False
(False) and (True) --> False
or Operator:
a=11
b=10
c=10
a==b and a==c --> False
(False) and (True) --> True
not Operator:
not(b==c)
not(True) --> False
Task: Try to use these operators and check various conditions.
Tuesday 1 February 2022
Python practice programs for beginners - Day7
Try to apply the formatting to all the other arithmetic operators.
Program:
Example:
Day 7 Task:
Example:
Python practice programs for beginners - Day6
Welcome to the 30-day challenge of Python practising for beginners.
Day 5 practice program:
Practice all the Arithmetic Operators given:
Arithemtic Operators:
Program:
Day 6:
Formatting:
Syntax:
print(f'yout text {your variable}')
Example:
Python practice programs for beginners - Day5
Welcome to the 30-day challenge of Python practising for beginners.
Day 4 practice program:
The solution is similar to that of the sample program discussed.
Day 5:
Operators:
Friday 28 January 2022
Python practice programs for beginners - Day4
Welcome to the 30-day challenge of Python practising for beginners.
Day 3 Solution:
Program:
Day 4:
Type Casting:
Practice Program Day 4:
Thursday 27 January 2022
Python practice programs for beginners - Day3
Welcome to the 30-day challenge of Python practising for beginners.
Day 2 Solution:
Program:
Output:
Get Input from user:
So far, we have given the value to the variable in coding itself. Now we will try to get the input from the user at run time.
use input() function to get the input.
Program:
Output:
Practice program 3:
Try to use this input() to the previous program and provide the input at the run time.
--> Get the input from the user
--> Print the values
--> Print the type of variables.
Wednesday 26 January 2022
Python practice programs for beginners - Day2
Welcome to the 30-day challenge of Python practising for beginners.