Python comes with an amazing standard math library that provides all trigonometric functions like sin, cos, etc. You can import that library and use these functions. Note that these functions expect angles in radians. For example,import math angle1 = math.radians(90) angle2 = math.radians(60) print(math.cos(angle1)) print(math.cos(angle2))This will give the output:6.123233995736766e-17 0.5The first value is very close to zero. Such errors come due to computation limits.
Use the d-*block class in Bootstrap to create block on a specific screen width.You can set it for small, medium, large, and extra large screen size − d-sm-block d-md-block d-lg-block d-xl-block You can try to run the following code to implement the d-*-block class −ExampleLive Demo Bootstrap Example Blocks Resize the browser to check the effect block Small Screen Size Medium Screen Size Large Screen Size Extra Large Screen Size
Use the .d-*-flex class in Bootstrap to set a flexbox container on a screen size as shown below −d-flex d-sm-flex d-md-flex d-lg-flexAbove the flex is set for different screen sizes, for example,d-sm-flex = Flex for Small Screen Sized-md-flex = Flex for Medium Screen Sized-lg-flex = Flex for Large Screen Sized-xl-flex = Flex for Extra Large Screen SizeLet us see an example of the class −ExampleLive Demo Bootstrap Example Understanding Flex d-flex Small Screen Size Medium Screen Size Large Screen Size Extra Large Screen Size
To stretch gathered items, use the .align-content-stretch class in Bootstrap 4. Use the align-content-stretch class as −
To align single rows of items at the end on different screens in Bootstrap 4, use the .align-items-*-end class.Align on different screen sizes −Medium Screen Size Product 1 Product 2 Product 3 Product 4 Large Screen Size Product 1 Product 2 Product 3 Product 4 You can try to run the following code to align single rows of items at the end on specific screen sizes −ExampleLive Demo Bootstrap Example Align Flex Items on a single row at the end Product 1 Product 2 Product 3 Product 4 Small Screen Size Product 1 Product 2 Product 3 Product 4 Medium Screen Size Product 1 Product 2 Product 3 Product 4 Large Screen Size Product 1 Product 2 Product 3 Product 4
Use the .align-items-center class in Bootstrap to align single rows of items in the center.To align in the center −Now add the flex items − Item 1 Item 2 Item 3 Item 4 You can try to run the following code to implement the align-items-center class in Bootstrap 4 −ExampleLive Demo Bootstrap Example Align Flex Items on a single row at the center Item 1 Item 2 Item 3 Item 4
To align items in the center on different screen sizes, use the justify-content-*-center class.The aligned flex items would be like the following for small screen size − GOLF CRICKET SQUASH The aligned flex items would be like the following for medium screen size − GOLF CRICKET SQUASH The aligned flex items would be like the following for large screen size − GOLF CRICKET SQUASH Let us see how to implement the justify-content-*-center −ExampleLive Demo Bootstrap Example Sports Centered on small screen GOLF CRICKET SQUASH Centered on medium screen GOLF CRICKET SQUASH Centered on large screen GOLF CRICKET SQUASH
To check if a float value is a whole number, use the float.is_integer() method. For example,print((10.0).is_integer()) print((15.23).is_integer())This will give the outputTrue False
Objects of different types except numbers are ordered by their type names; objects of the same types that don’t support proper comparison are ordered by their address. When you order two strings or two numeric types the ordering is done in the expected way (lexicographic ordering for string, numeric ordering for integers).When you order a numeric and a non-numeric type, the numeric type comes first.If you have a number in a str object, you can simply convert it to a float or an int using their respective constructors. For example, i = 100 j = "12" int_j = int(j) print(int_j ... Read More
The transport layer is responsible for error-free, end-to-end delivery of data from the source host to the destination host. It corresponds to the transport layer of the OSI model.The functions of the transport layer are −It facilitates the communicating hosts to carry on a conversation.It provides an interface for the users to the underlying network.It can provide for a reliable connection. It can also carry out error checking, flow control, and verification.The protocols used in this layer are −Transmission Control Protocol, TCP − It is a reliable connection-oriented protocol that transmits data from the source to the destination machine without ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP