How to print float number in python using for loop?
i=0
j=0
for i in range (0,3,0.1):
for j in range (0,4,0.1):
print(i,j)
TypeError: 'float' object cannot be interpreted as an integer
The range() function can only work with integers (whole numbers, not decimals/floats).
The easiest way is to use numpy.arange or numpy.linspace option and python's enumerate().
Though using nested for loops isn't the ideal case, consider using numpy.meshgrid() and numpy.reshape().
See attached.
see
range function in python cannot take float number as a step value. You can write your own generator or else use numpy like below
import numpy as np
for i in np.arange(0.0,3.0,0.1):
for j in np.arange (0.0,4.0,0.1):
There are plenty of ways to achieve this (you may also want to use round function to round the resulting float values).
Both proposed solutions work well. The last one the most straight forward and intuitive but as said there are many ways of doing this and the best depends on how you will use the results later. I presume that the print is just to test the structure.
Thank you all for your support.
How to apply surface traction boundary condition as internal pressure in pipe bend analysis in abaqus.
03 April 2019 8,603 1 View
In pipe bend analysis, I am carrying out two step analysis. In first step, internal pressure applied and in second step rotation is applied. Now, how to extract their moment-end-rotation data?...
02 March 2019 2,130 5 View
How to import Numpy package (Python 3.6) to Abaqus 2017?
04 May 2018 1,366 0 View
I am working on Pipe bend analysis. I am having some FEA results for collapse moment. I need to form empirical formula. How to do that?
02 March 2018 6,154 4 View
I am studying research papers relevant pipe bend/elbow analysis. In most of the papers closed form solution has been given. How this closed form solution are obtained I just didn't understood....
01 February 2018 9,780 3 View
I have done some analysis of pipe bend. To calculate the limit load Moment vs Rotation curve is must. Anybody please explain how to obtain it?
01 February 2018 5,758 2 View
I'm studying the pipe elbow but i don't know how to assign Elbow element in ABAQUS/CAE. I am not able to find ELBOW elements. Can anyone suggest about it? i dont know where to find it in abaqus...
11 December 2017 2,462 3 View
I am modelling and analyzing the pipe bend in ABAQUS/CAE and element type is C3D20R.. How can i add uniform pressure in initial step?
11 December 2017 4,817 3 View
i am unable to interpret why its increases in start as shown in figure
11 August 2024 2,179 1 View
I'm currently exploring the application of Python in textile engineering, specifically in areas like data analysis, process automation, and the development of smart textiles. I'm interested in...
10 August 2024 7,429 2 View
Request Python code from this article : Gender equity of authorship in pulmonary medicine over the past decade. THANKS!
08 August 2024 6,242 2 View
Visual Studio Code (VS Code) has become a popular choice among developers for several reasons: 1. **Free and Open Source**: VS Code is free to use and open source, making it accessible to...
07 August 2024 7,013 4 View
I need the python code to forecast what crop production will be in the next decade considering climate and crop production variables as seen in the attached.csv file.
05 August 2024 2,977 3 View
Hello everyone, I am currently working on a research project that aims to integrate machine learning techniques into an open source SIEM tool to automate the creation of security use cases from...
04 August 2024 3,196 2 View
How can I interpret the data gathered without solving?
03 August 2024 9,054 3 View
I have been publishing the Nepalese Journal of Agricultural Sciences (online ISSN 2091-0428; print ISSN 2091-042X) on www.nepjas.com and research gate. I was wondering how I can get an impact...
01 August 2024 1,277 1 View
I have found an EEG where only alpha waves are present. Beta waves are not found in active patients. What interpretations ?
26 July 2024 4,741 1 View
While doing AST for Pseudomonas aeruginosa, after incubation, no zone of inhibition observed in the plate near the well. wells surrounded by bacterial growth, when the same plate observed under UV...
25 July 2024 9,229 1 View