Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

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

Python practice programs for beginners - Day1

No comments :

 

Python practice programs for beginners - Millioninformations


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


Python practice programs for beginners - Day1


Variables:

Variables are the most important concept in any programming language. It will help to store any data which we can use throughout the program.

Example: userName="millioninformations"

userName is the variable name and "millioninformations" is the value stored in that variable.

Rules for declaring Variables:

1.Variable must start with lowercase letter
2. Should not contain space or special characters.
3. Underscore can be used to connect two words
4. Also can follow camelCase (first words first letter in lower case and second words first letter in upper case)

Practice Program - Day 1

Write a Program to store a Student's details using the below variable names:

--> studentName
--> studentAge
--> studentGender
--> institute


Sample output:



Try to complete the task.

The output will be displayed in the next post.

If you are reading this post for the first time do read: 

Read More

Tuesday 25 January 2022

How to run Python program

2 comments :

 

how to start with python programming - millioninformations


30 Days Python Practice Challenge for Beginners.

Python is the most powerful but simple programming language right now.

This Python practice program for beginners will help you to get confidence in the basics of Python programming.

Learn how to Install Python

Since we need to use Python you may also download Python or also can use online python compilers. For mobile users download the Pydroid 3 app or QPython 3L.


Method 1: Using IDLE in Laptop (Once Python Installed)

Once you have installed Python, let's open idle.

You can search IDLE in the windows search bar.

python idle - millioninformations


You can something like this once opened.





Click on File --> New File

You will get a file like this. In this, you can start practising the program.

Once you typed it, you can save it and run the program by clicking Run option.



Method 2: Using online Interpreter 

Easy to get started for beginners.

python online compiler - Interpreter


Method 3: Mobile App

For mobile users download the Pydroid 3 app or QPython 3L.









I hope now you can able to use any of the given methods to run your python program.

From next post we will be doing 30 day challenge for Python program practice. It will not be like tutorials instead you will be practicing the program and self analysing the output.

Read More

Thursday 21 October 2021

How to install Python?

No comments :

 Follow the simple steps to install python and run your first python program.

Step 1: Visit the official python webiste.

https://www.python.org/downloads/

Step 2: Click download Python.

Step 3: Click the downloaded file and start installing.

Step 4: After installation is complete, open the command prompt and type python.


If you get the screen like this Python and version name in my case it is Python 3.9.5 then it means python is installed in your system.

If it shows some error you need to add the python compiler path in environment variables.

Also read: How to edit environment variables

https://www.millioninformations.com/2015/08/how-to-resolve-javac-is-not-recognized.html

Read More