Saturday 12 February 2022

Python practice programs for beginners - Day 16

1 comment :

 

Python practice programs for beginners - Millioninformations

Day 15 Solution:


Output:

for loop even number


Day 16: For Loop

Mini Project 2:

Get a number from the user and display the multiplication table of that number. You can also get them up to which number you can display the table.



Read More

Friday 11 February 2022

Python practice programs for beginners - Day 15

1 comment :

 

Python practice programs for beginners - Day 15


Day 14 Solution:


Output:

Day 15 : for loop

If you see in the above picture the output is starting from 0 and ending with 9. If we want to start from 1 to 10 then we need to change the code in the range.


In this we have to use from 1 to 11 (10+1) because the loop runs from 1 to whatever the value mentioned at end position -1.

Output:

Day 15 Task: 

Get start value and end value from the user at run time and print all the even numbers between that range.


Read More

Thursday 10 February 2022

Python practice programs for beginners - Day 14

1 comment :

 

Python practice programs for beginners - Day 14


Day 13 Solution:

Python Grade Checker Project Source Code:

Download 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






Read More

Wednesday 9 February 2022

Python practice programs for beginners - Day 13

1 comment :

Python practice programs for beginners - millioninformations

 
Welcome to Day 13 of the 30 days Challenge.

Day 12 Solution:


Day 13: 

So far we have practised on

1. Variables
2. Operators
3. Control statements
4. String formatting

with the help of all these try to do the below task:

Project 1: Grade Checker Project

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:

Python - grade checker program

Will see the solution in the next post.


Read More

Tuesday 8 February 2022

Python practice programs for beginners - Day 12

1 comment :

 

Python practice programs for beginners - millioninformations


Day 11 solution:


Output:


Day 12: String Format

In the above program instead of using 

print(number3," is the greatest number")

We can use 

 print(f'{number3} is the greatest number')

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.

Task:

Try to reprogram the above logic using String formatting.




Read More

Monday 7 February 2022

Python practice programs for beginners - Day 11

3 comments :

 

Python practice programs for beginners - millioninformations


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.



Read More

Python practice programs for beginners - Day 10

2 comments :

 

Python practice programs for beginners- millioninformations


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.


Read More

Python practice programs for beginners - Day9

1 comment :

 

Python practice programs for beginners - millioninformations


Day 8 solution:


Program

x and y is False
x or y is True
not x is False
Solution

Day 9:

if statement:

Syntax:

if condition:
    #Statements to be executed once the condition is True

Example:

number=10

if  number>0:
    print("The number is positive")


Output:
   The number is positive


Task:

Try to get two single-digit numbers from the user then add the two numbers and if the addition of those two numbers is above 10 then print "You score greater than 10". If the addition is below 10 then print "You score less than 10".

Will see the solution in next post.









Read More

Python practice programs for beginners - Day8

1 comment :

 

Python practice programs for beginners - millioninformations


Day 7 Solutions:



a=int(input("Enter the number: "))
b=int(input("Enter the number: "))
print(f'{a} is greater than ">" {b} True or False? Result:{a>b}')
print(f'{a} is Lesser than "<" {b} True or False? Result:{a<b}')
print(f'{a} is equals to "==" {b} True or False? Result:{a==b}')
print(f'{a} is not equals to "!=" {b} True or False? Result:{a!=b}')
print(f'{a} is greater than or equals to ">=" {b} True or False? Result:{a>=b}')
print(f'{a} is lesser than or equals to "<=" {b} True or False? Result:{a<=b}')


Output:

Enter the number: 4
Enter the number: 4
4 is greater than ">" 4 True or False? Result: False
4 is Lesser than "<" 4 True or False? Result: False
4 is equal to "==" 4 True or False? Result: True
4 is not equal to "!=" 4 True or False? Result: False
4 is greater than or equals to ">=" 4 True or False? Result: True
4 is lesser than or equals to "<=" 4 True or False? Result: True


Day 8: Logical Operator

Logical Operators helps us to check more than one condition at a time.

we have 3 operators.

and - returns True when both operands return true else false

or - returns True if at least one of the operands is true.

not - returns True if the specified condition is not met.

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.








Read More

Tuesday 1 February 2022

Python practice programs for beginners - Day7

1 comment :

 

Python practice programs for beginners - millioninformations


Day 6 Program:

Try to apply the formatting to all the other arithmetic operators.


Program:



Output:




Day 7:

Relational Operators:

== --> Equals
!= --> Not Equals
> --> Greater than
< --> Lesser than
>= --> Greater than or equals
<= --> Lesser than or equals


Relational operators in python or comparison operators in python are used to find the relationship between 2 numbers/variables.

This expression will return Either True or False depending on the expression we use.


Example:


a=10
b=20
a==b i.e  10==20 

Output = False

Since 10 and 20 are not equals we get the result as False.

Day 7 Task:


Try out all the relational operators along with the string formatting concept learned on Day 6.

Example:




Try to complete the task.

The output will be displayed in the next post.
Read More

Python practice programs for beginners - Day6

1 comment :

 

Python practice programs for beginners - millioninformations

Welcome to the 30-day challenge of Python practising for beginners.

Day 5 practice program:

Practice all the Arithmetic Operators given:

Arithemtic Operators:


Addition --> +
Subtraction --> -
Multiplication --> *
Division (Quotient) --> /
Division (Remainder) --> %
Exponentiation --> **
Floor Division --> //

Program:



Output:




Day 6:
Formatting:


In the above output, you can see the output are getting displayed but it is not that clear to the user.

So we will use String formatting.

Syntax:


print(f'yout text {your variable}')


Example:



Output:




Day 6 Task:


Try to apply the formatting to all the other arithmetic operators.

Try to complete the task.

The output will be displayed in the next post.



Read More

Python practice programs for beginners - Day5

1 comment :

 

Python practice programs for beginners - millioninformations

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:

Operators are something that helps us to work with operands.
There are more operators in python.
In this post, we will try to learn the Arithmetic operator.

Arithemtic Operators:

Addition --> +
Subtraction --> -
Multiplication --> *
Division (Quotient) --> /
Division (Remainder) --> %
Exponentiation --> **
Floor Division --> //

Example:

a=int(input("Enter the number"))
b=int(input("Enter the number"))
print(a+b)

Output:


Day 5 Practice:

Practice all the Arithmetic Operators given above.

Try to complete the task.

The output will be displayed in the next post.
Read More

Friday 28 January 2022

Python practice programs for beginners - Day4

1 comment :

 

Python practice programs for beginners - millioninformations

Welcome to the 30-day challenge of Python practising for beginners.

Day 3 practice program:

Day 3 Solution:

Program:


Solution:

Day 4:


Type Casting:

In the above example if you have noticed we got 2 inputs from the user. 

Name and Age, where name is a String and Age is a number but in the above output, you can see that is also String. 

To convert one type of data into another type we need to do Type Casting.

Syntax:

type_name(variable)

Example:

Program:


Output:



So after typecasting, you can see that the type of Age variable is int which is a number.

Practice Program Day 4:

Write a program:

--> Get different data about a person

--> Find the type of data getting stored

--> Try to change the type of a variable and print it

Try to complete the task.

The output will be displayed in the next post.
Read More

Thursday 27 January 2022

Python practice programs for beginners - Day3

1 comment :

 

Python practice programs for beginners - millioninformations

Welcome to the 30-day challenge of Python practising for beginners.

Day 2 Practice Program:

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.

Try to complete the task.

The output will be displayed in the next post.


Read More

Wednesday 26 January 2022

Python practice programs for beginners - Day2

1 comment :

 

Python practice programs for beginners - millioninformations


Welcome to the 30-day challenge of Python practising for beginners.


Day 1 Practice Program:

Day 1 Solution:


Python practice programs for beginners - Day2

Data types:

In the previous post, we practised variables. In this post, we will practice data types. 

The type of data we are storing in the variable is called Data type.

Text kind of data is called as String, whole numbers such 5, 10 are called as Integers. Decimal valued data are called the float. True or False kinds of data are called Boolean.

to check the type of your data stored in the variable you can use type(variable_name) inside the print function.

Example:

Python practice programs for beginners - millioninformations


Output: 


Practice Program - Day 2

Find the different types of data for the Day 1 program.

Also try to use Float, Boolean.

Try to complete the task.

The output will be displayed in the next post.


Read More