Posts

Showing posts from July, 2021

Prime numbers with Python

Image
here we are going to learn how to find if a number is prime or not using Python code and also how to print only prime numbers between 1 to 1000 or more. it's going to be really fun to learn python programming language with questions and trying to find answers. import pandas as pd def prime(x): if x<=1: return ('Not') if x==2: return ('Prime') for i in range(2,x//2+1): if x%i==0: return('Not') return('Prime') prime(10993) y=range(1,1001) for i in y: print(i,prime(i)) pri=[] y=range(1,1001) for i in y: pri.append(prime(i)) str(pri.count('Prime'))+' prime',str(pri.count('Not'))+' Not prime' dt=[range(1,1001),pri] pn = {'num': range(1,1001), 'prime': pri } primedf = pd.DataFrame(pn, columns = ['num', 'prime']) for i,j in zip...

Python code to print Fibonacci series (1,1,2,3,5,8,13,21,34,55,89,144,233,377)

Image
Python programming to print the Fibonacci sequence (1,1,2,3,5,8,13,21,34,55,89,144,233,377)we are going to use while loop for this tutorial, in this python tutorial we will learn how o print the Fibonacci series of numbers in Python using while loops for the video follow this a,b=0,1 while b<500: print(b) a,b=b,a+b #or to get it in a list c=[] a,b=0,1 while b<500: c.append(b) a,b=b,a+b print(c)

How to check if a number is even or odd in Python

Image
hello, In this tutorial we are going to learn how to check if a given number is even or odd in Python(Jupiter Notebook).  a=range (1,21) Even=[ ] Odd=[ ] for i in a: if i%2==0: Even.append(i) Else: Odd.append(i) or a=range (1,21) for i in a: if i%2==0: print("even") Else: print("odd")

Python Data Types Boolean

Image
Boolean In programming We should know if the given statements True or False . so we evaluate the statements in Python and get  True   or  False . whenever we compare two or more value or expression ,and Python will return Boolean value ( True  or  False ) And whenever you run a condition in an if statement, Python returns if the condition is  True  or  False In the above code we can see that if the given condition (x>y) is  True  then it will print ("x is greater than y") else it will print ("y is greater than x")

Python Data Types

 Before we go into the "coding" part, Let's first see what are all different types of Data types in python. Data Types Numeric Integers Float Complex Numbers Dictionary Boolean Set Sequence type Strings List Tuple Numeric a,b,c = 10 , 15.65 , 5j + 2 print ( type (a)) class 'int' print ( type (b)) class 'float' print ( type (c)) class 'complex' Sequence Typ e name= "ket" cart=[ "pen" ,10, "hd" ] product=( "egg" , "milk" , "chicken🐔" ) print ( type (name)) <class 'str'> print ( type (cart)) <class 'list'> print ( type (product)) <class 'tuple'> Well, this is a basic look  of Strings, Lists, Tuples, Integer, Float, Complex Numbers. we will see more about Dictionary, Boolean, And Set in the next post. Previous                                              ...

Python Installation

System💻 Requirements🔧 Modern Operating System: Windows 7 or 10 Mac OS X 10.11 or higher, 64-bit Linux: RHEL 6/7, 64-bit (almost all libraries also work in Ubuntu) x86 64-bit CPU (Intel / AMD architecture) 4 GB RAM🐏 5 GB free disk space💾 Select Python🐍 Version              The version you need to download is dependent on what you want to do in Python. like, if you are working on a project coded in Python version 2.6, then we need that version. If you are starting a project from scratch, you have the freedom to choose. If you are learning Python, we recommend downloading both the Python version of Python 2 and 3.  Python🐍 installation             To download Python, go to this link Download Python , and select 64-bit or 32-bit based on our system requirement. Anaconda installation             Anaconda has a library of over 400 popular packages. which is used by data science pr...

Python for Data Science

what are different programming languages used in D.S(data science) why we should learn  Python  for D.S how to learn  Python  for D.S where to learn Python for D.S is  Python  compulsory for D.S? Python  v/s R "Hello world" this is Python Basics with another new post about python for data science, in this post we are going to see the following points. What are different programming languages used in D.S(data science) Python JavaScript Scala R SQL Julia Why we should learn Python for D.S before we find out how to learn  Python  for  Data Science , let's first know why we should select  Python  as a data science programming language. in other words, understanding  Python  is one of the top valuable skills needed for a data science or data analyst's career. Is  Python  is easy to learn? I would say yes and also no, why? because when we compare  Python  with other programming languages it is easy...

Python Intro

            Python is one of the popular and easy-to-learn programming languages. It was created on February 20, 1991, by Guido van Rossum . Python is a high-level programming language that can be applied to different classes of problems. Python is one of the easy-to-learn programming language because of its readability and has some resemblance as the English language with influence from mathematics. it is a general-purpose language that is designed to be easy to read, write, and understanding code even for the beginner and person who never code once in their life. Python also has Supportive Community , Healthy, and Active, python has been around for quite some time, it's not too old or new, it has been around most likely 30 years and there are so many documentation, guides, tutorials, and more. and the developer community is incredibly supportive. it means any time you need support or help, you will get it quickly. The python community he...