自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(33)
  • 收藏
  • 关注

原创 使用Python编程求函数极限【例1】

import sympyfrom sympy import ooimport numpy as npimport matplotlib.pyplot as plt# 使用sympy第三方库计算出函数sin(x)/x在自变量x趋于无穷大时的极限值。x = sympy.Symbol('x')f = sympy.sin(x)/xa = sympy.limit(f,x,oo)print(a)# 通过上面的代码可以计算出极限值为:0# 然后通过第三方库numpy和matplotlib...

2022-05-24 05:32:20 5685 1

原创 if-else in for loop

In this section, we will use how to use if-else statement with a loop. If-else is used when conditional iteration is needed. For example, print studetn names who got more than 80 percent.The if-else statement checks the condition and if the condition is

2022-05-24 05:05:26 179

原创 break & continue & pass for loop

Loop control statements change the normal flow of execution. It is used when you want to exit a loop or skip a part of the loop based on the given condition. It also knows as transfer statements.Now, let us learn about the three types of loop control sta

2022-05-24 05:05:09 180

原创 for loop with range()

The range() function returns a sequence of numbers starting from 0 (by default) if the initial limit is not specified and it increments by 1 (by default) until a final limit is reached.The range() function is used with a loop to specify the range (how ma

2022-05-15 13:42:16 154

原创 Python for loop

In this article, you'll learn what is for loop in Python and how to write it. We use a for loop when we want to repeat a code block a fixed number of times.A for loop is a part of a control flow statement which helps you to understand the basics of Pytho

2022-05-15 11:55:46 410

原创 Nested if-else statement

In Python, the nested if-else statement is an if statement inside another if-else statement. It is allowed in Python to put any number of if statements in another if statement.Indentationis the only way to differentiate the level of nesting. The nested..

2022-05-15 10:57:37 229

原创 Chain multiple if-elif-else statement

In Python, the if-elif-else condition statement has an elif blocks to chain multiple conditions one after another. This is useful when you need to check multiple conditions.With the help of if-elif-else we can makea tricky decision. The elif statement ..

2022-05-15 10:54:15 121

原创 If-else statement

The if - else statement checks the condition and executes the if block of code when the condition is True, and if the condition is False, it will execute the else block of code.Syntax of the if - else statementif condition: statement 1else: s

2022-05-15 10:51:07 128

原创 If statement

In control statements, the if statement is the simplest form. It takes a condition and evamuates to either True or False.If the condition is True, then the True block of code will be executed, and if the condition is False, then the block of code is skep

2022-05-15 10:49:04 138

原创 Python Control Flow Statements

In Python programming, flow control is the order in which statements or blocks of code are executed at runtime baed on a condition.Control Flow StatementsThe flow control statements are divided into three categories:Conditional statements Iterativ

2022-05-15 02:57:57 365

原创 Control Flow and Loops

In Python, flow control is the order in which statements or blocks of code are executed at runtime based on a condition. The loop statement repeats a code block a number of times.Learn to use loops, conditional statements, iterative statements, and trans

2022-05-15 00:38:40 218

原创 String type conversion

In str type conversion, we use the built-in funtion str() to convert variables of other types to a string type. This function returns the string type of object (value).Casting int to str typenum = 11print(type(num)) # class 'int'# convert int to

2022-05-15 00:22:44 93

原创 Bool type conversion

We use the built-in function bool() to convert valus of other types of bool types. This function returns two valus, either True or False.We can convert any type of values to bool type, and the output for all values will be True, except 0, which is False.

2022-05-15 00:22:26 104

原创 Complex type conversion

In complex type conversion, we use the built-in function complex() to convert values from other types to the complex type. Value can be any type including of int, float, bool, and str.The complex funciton has the following two forms for conversion.comp

2022-05-14 22:16:10 90

原创 Int & Float type conversion

In int type conversion, we use the int() function to convert variables of other types to int type. Variable can be of any type such as float, string, bool.While performing int type conversion, we need to remember the following points.When converting st

2022-05-14 20:38:46 99

原创 Python Type Conversion or Type Casting

In Python, we can convert one type of variable to another type. This conversion is called type casting or type conversion.In casting, we convert variables declared in specific data types to the different data types.Python performs the following two typ

2022-05-14 19:23:19 154

原创 Bool & other data type

Bool data typeIn Pythin, to represent boolean values (True and False) we use the bool data type. Boolean values are used to evaluate the value of the expression. For example, when we compare two values, the expression is evaluated, and Python retuns th

2022-05-14 13:57:11 99

原创 Dict & Set data type

Dic data typeIn Python, dictionaries are unordered collections of unique values stored in (Key-Value) pairs. Use a dictionary data type to store data as a key-value pair.The disctionary type is represented using a dict class. For example, if you want

2022-05-14 03:03:49 108

原创 List & Tuple data type

List data typeThe Python List is an ordered collection (also known as a sequence) of elements. List elements can be accessed, iterated, and removed according to the order they inserted at the creation time.We use the list data type to represent group

2022-05-14 02:24:28 97

原创 Float & Complex data type

Float data typeTo represent floating-point values or decimal values, we can use the float data type. For example, if we want to store the salary, we can use the float type.The float type in Python is represented using a float class.We can create a

2022-05-14 01:53:21 138

原创 Str & Int data type

Str data typeIn Python, a string is a sequence of characters enclosed within a single quote or double quote. These characters could be anything like letters, numbers, or special symbols enclosed within double quotation marks. For example, "Python" is a

2022-05-14 01:23:03 118

原创 Python Data Types

Data types specify the differrent sizes and values that can be stored in the variable. For example, Python stores numbers, strings, and a list of values using different data types.Python is a dynamically typed language. Therefore, we do not need to speci

2022-05-14 00:47:28 186

原创 Variable‘s case-sensitive

Python is a case-sensitive language. If we define a variable with names a = 100 and A = 200 then, Python differentiates between a and A. These variable are treated as two different variable (or objects).Example:a = 100A = 200# value of aprint(a) #

2022-05-14 00:08:21 100

原创 Delete a variable

Use the delkeyword to delete the variable. Once we delete the variable, it will not be longer accessible and eligible for the garbage collector.Example:var1 = 100print(var1) # 100Now, let's delete var1 and try to access it again.Example:var1..

2022-05-13 22:48:33 77

原创 Get the data type of variable

No matter what is stored in a variable(object), a variable can be any type like int, float, str, list, tuple, dict, etc. There is a built-in function called type() to get the data type of any variable.The type() function has a simple and straight forward

2022-05-13 22:30:57 73

原创 Create Number, String, List variables

We can create different types of variables as per our requirements. Let's see each one by one.NumberA number is a data type to store numeric values. The object for the number will be created when we assign a value to the variable. In Python3, we can

2022-05-13 02:32:03 171

原创 Changing the value of a variable

Many programming languages are statically typed languages where the variable is initially declared with a specific type, and during its lifetime, it must always have that type.But in Python, variables are dynamically typed and not subject to the data typ

2022-05-13 02:18:46 84

原创 Creating a variable

Python programming language is dynamically typed, so there is no need to declare a variable before using it or declare the data type of variable like in other programming languages. The declaration happens automatically when we assign a value to the variab

2022-05-13 02:09:12 73

原创 Variables and Data Types

To learn how to create, modify, delete variables of different types. Learn to use some basic numeric (int, float, and complex), string, and Boolean types that are built into Python.For example, we can create a variable with a specific name. Once you crea

2022-05-13 01:49:37 84

原创 Create and Run Your First Python Program

Now, the installation is completed. Let's see how to write our first Python program.We can run Python by using the following three ways:#1 Run Python using IDLE ( Integrated Development Environment )#2 Run Python interactively using command line in i

2022-05-13 01:31:37 86

原创 Install Python

It may be possible that some PCs and Macs will have Python already installed. You can check which version of Python is installed before proceeding to the installation.Open the CMD-Command line to termnal and type the below command.python -- versionI

2022-05-13 01:20:22 92

原创 An Introduction to Python

This section will help you get started with Python Programming language by installing it and running your first program. Also, it will walk you through the basic concepts and fundamentals of Python.We need to download Python software from Python web port

2022-05-13 01:03:09 109

原创 Python Basics for Beginners (Manual Input)

This Python essential exercise is to help Python beginners to learn necessary Python skills quickly. Practice Python basic concepts such as loops, control flow, data types, operatiors, list, string, input and output, and built in functions.Here we learn

2022-05-13 00:48:18 113

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除