Python Definition and 655 Threads
-
Python How to Import and Manipulate Data from a Text File in Python?
Hi Lets say I have a txt file with m rows with n columns of numbers of the form: Lets say I want to take every p'th row and take the second and third columns and turn it into a \frac{m}{p}\times 2 matrix. How would I go about doing that?- Avatrin
- Thread
- Matrix Numpy Python
- Replies: 4
- Forum: Programming and Computer Science
-
C
Python Simple Python Database Tutorial & Example
Can anyone refer me to a tutorial or example Python database progam? I'm trying to understand how one might create and manipulate a simple/small database such as a file containing names, addresses, and phone numbers. I've spent an hour or two searching and keep finding references to SQL and or...- CWatters
- Thread
- Database Python
- Replies: 6
- Forum: Programming and Computer Science
-
S
Python Security alert for python libraries
This security alert http://www.nbu.gov.sk/skcsirt-sa-20170909-pypi/ warns against fake python libraries: containing "malicious (but relatively benign) code".- Stephen Tashi
- Thread
- Libraries Python Security
- Replies: 2
- Forum: Programming and Computer Science
-
M
LaTeX Printing Code from Python in Latex via "minted"
Hi PF! I am trying to import code written in Python into Latex via the "minted" package. However, I am getting the error: Package minted error: you must invoke latex with the -shell-escape flag. I tried googling help but I can't figure it out. I'm using Python 2.7 on mac OSX sierra. Any help...- member 428835
- Thread
- Code Latex Printing Python
- Replies: 3
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
Python Insert data into excel, calculate+retrieve data using Python
Hello, I currently have a Google Sheets document that I want to run some analysis on. The document is very formula- heavy (not just raw data). It takes a set of input numbers and does some computations and gives me an important output number at the bottom of the spreadsheet. These computations...- Hercuflea
- Thread
- Data Excel Python
- Replies: 5
- Forum: Programming and Computer Science
-
Python Why am I getting 'nope' instead of 'works' when using sockets in Python?
Hi everyone, I have just started learning sockets in python and I have made the following code: import socket HOST = '' PORT = 8888 def main(): while 1: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT))...- ShaddollDa9u
- Thread
- Code Python Socket
- Replies: 11
- Forum: Programming and Computer Science
-
Python Python workflow for experimental data analysis
Hello! I have been using python for my data analysis and processing needs as an experimental physicist for an year now. I have used MATLAB and originpro before and python provides me everything I need. But I am not satisfacted with my worflow specifically for plotting needs. I often find myself...- franciobr
- Thread
- Analysis Data Data analysis Experimental Experimental data Python
- Replies: 6
- Forum: Programming and Computer Science
-
Python Making my web page publicly available
I want to make a web page. I made it work in local network using python and Flask module. It also saves and uses data in responses, that it has got by GET and POST requests. What should I do to make it publicly available so that I had to change the original script with flask as little as...- olgerm
- Thread
- Python Web
- Replies: 15
- Forum: Programming and Computer Science
-
O
C/C++ Are AIML, Lisp, C++, and Python the Best Choices for AI Programming?
I found an article about AI programming languages (https://qubit-labs.com/ai-programming-languages-choose/) and I've got several questions: 1. Are AIML and Lisp still used in programming? 2. Several sources refer to C++ as the fastest programming language? In what way the speed of language is...- Oscar Flick
- Thread
- Ai Artificial inteligence Python
- Replies: 20
- Forum: Programming and Computer Science
-
A
Python Help with Python modelling of a particle in a 2D box
Hello guys, I programmed a physics simulation where a particle with some initial conditions bounces off the walls of a 2d container. The simulation also includes gravity in the y-coordinates. The aim of the project is to produce a visual animation and further on include more particles and...- Alex Cros
- Thread
- 2d Box Classical physics Matplotlib Modelling Particle Programming Python
- Replies: 1
- Forum: Programming and Computer Science
-
Python Algorithm Optimization [Python]
Homework Statement Given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum. sum_pairs([11, 3, 7, 5], 10) # ^--^ 3 + 7 = 10 == [3, 7] sum_pairs([4, 3, 2, 3, 4]...- Jamison Lahman
- Thread
- algorithm optimization python
- Replies: 2
- Forum: Programming and Computer Science
-
Python Python, Julia, Jupyter .... clouds
Hello, Since a few months I enjoy learning and using Python, Julia, R, Jupyter. I abandoned Fortran long ago. Today, I decided to break with the more recent past. I will stop computing in Excel and C#, (mainly for process simulation, since more than 10 years) ... I would also like to stop...- maajdl
- Thread
- Python
- Replies: 3
- Forum: Programming and Computer Science
-
S
Python How to Correctly Simulate an Infinite Well in Python?
I'm trying to get the eigenfunctions and eigenvalues (energies) of an infinite well in Python, but I have a few things I can't seem to fix or don't understand... Here's the code I have: from numpy import * from numpy.linalg import eigh import matplotlib.pyplot as plt from __future__ import...- svletana
- Thread
- Eigenvalues Infinite Infinite well Python Quantum
- Replies: 6
- Forum: Programming and Computer Science
-
Python What is the Intel Distribution for Python and how can it improve data analysis?
Hello, I am relatively new to Python. I would really like to use Python for numerical and data analysis. I recently stumbled upon something called Intel Distribution from this article: http://www.infoworld.com/article/3117239/data-science/intels-python-distribution-turbocharges-data-science.html...- Jamison Lahman
- Thread
- Distribution Python
- Replies: 5
- Forum: Programming and Computer Science
-
E
Python How to Install the Basemap and the GEOS Library?
I have been following this procedure on installing the basemap and the GEOS library: https://matplotlib.org/basemap/users/installing.html I have searched through other alternatives, but they seem to provide the same procedure. I need help on understanding the "Installation" process. I am using...- ecastro
- Thread
- install Python
- Replies: 6
- Forum: Programming and Computer Science
-
S
Python Numerical integration in Python (throwing a ball)
Homework Statement I have a problem with my physics task, but you do not need to understand physics to be able to help me, because my main problem is bad programming skill. I am dealing with a problem of throwing a ball in the air at an angle between 0 an 45 degrees. I need to consider not only...- srecko97
- Thread
- Ball Integration Numerical Numerical integration Python
- Replies: 6
- Forum: Programming and Computer Science
-
O
Python Wave on string: How can I create a traveling triangle pulse?
I have the following program that moves a wave on a string with fixed ends. The program solves the wave equation given a initial condition wave. The initial condition is a triangle wave splitting into two pulses. Here is the code written in Python: from numpy import * from matplotlib.pyplot...- Omsin
- Thread
- Mechanic of fluids Numerical differentiation Pulse Python Standing waves String Triangle Wave
- Replies: 5
- Forum: Programming and Computer Science
-
X
N-body simulation - straight line orbits
Homework Statement The problem is your typical N-body simulation, implemented using Python and Numpy. The implementation specifically calls for using the Euler-Cromer method. For this particular case I used the Sun and the first 4 planets of the solar system. Essentially the problem is I'm...- XanMan
- Thread
- Gravity Line N-body simulation Orbits Physics Python Simulation Straight line
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
Python How Can I Plot Multiple Alpha Values in Cosmology Using Python?
Hello! I've been working on a code that solves the Friedmann equation with quintessence using a scalar field potential of the form x^(-alpha) where alpha is a free parameter. I would like to plot different values of alpha in the same plot with annotations for each. For now, my code has initial...- arnazkh
- Thread
- Cosmology Plots Python Quintessence
- Replies: 1
- Forum: Programming and Computer Science
-
A
MATLAB Python and MATLAB giving different results for same code?
I am trying to learn Python by translating my MATLAB codes into Python. My translated Python code is giving slightly different result as compared to that of MATLAB. Although difference is very small but it affects largely the results at later stage. My Python code is import numpy as np import...- Atr cheema
- Thread
- Code Matlab Python
- Replies: 11
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
L
Python Recursion in python functions -- confusion
example code from python-course.eu def factorial(n): print("factorial has been called with n = " + str(n)) if n == 1: return 1 else: res = n * factorial(n-1) print("intermediate result for ", n, " * factorial(" ,n-1, "): ",res) return res...- late347
- Thread
- Confusion Functions Python Recursion
- Replies: 19
- Forum: Programming and Computer Science
-
Python How to build a linked list in python
Homework Statement [/B] Build a linked list with values of 1, 2 and 3 The Attempt at a Solution class ListNode(object): def _init_(self,x): self.val=x self.next=None root=ListNode(1) root.next=ListNode(2) root.next.next=ListNode(3) print(root.val) I keep...- FallenApple
- Thread
- Build List Python
- Replies: 9
- Forum: Programming and Computer Science
-
M
Python Merging FITS Images with Python & Astropy
Hello everyone, I would like to know how I can combine two FITS images (which are continuum maps of two sources) in python using astropy. Bests- mahya
- Thread
- Images Python
- Replies: 1
- Forum: Programming and Computer Science
-
Python Progressively harder Django challenges
Hi I am trying to improve my resume by making websites using Django (I own two websites). However, I am not sure how to get started. I just want to create something that makes me more employable. I have used Python in mathematics and physics. I am going through the Codeacademy courses on HTML...- Avatrin
- Thread
- python
- Replies: 3
- Forum: Programming and Computer Science
-
S
Python Object-Oriented Implementation of Python ATM Script: Where Did I Go Wrong?
hello everyone, I am a new member of this forum I found really good topics and good community that helps with many scientific fields. So I have this long text-based user interface for banking system written in python functions , but needs to be written using object oriented programming. I had...- sedat96
- Thread
- coding homework oop python
- Replies: 4
- Forum: Programming and Computer Science
-
Great, glad to hear it's working now! Happy coding :)
Homework Statement Define a procedure that does the following: From the string of numbers from 1 - 9 it creates a list that contains the numbers that are bigger than the preceding number and adds the smaller ones to a sub-list. Example: string='3057842103' print(numbers_in_list(string))...- doktorwho
- Thread
- Code Procedure Python Writing
- Replies: 3
- Forum: Programming and Computer Science
-
What is the mistake in this Sudoku checker code?
Homework Statement # Sudoku [http://en.wikipedia.org/wiki/Sudoku] # is a logic puzzle where a game # is defined by a partially filled # 9 x 9 square of digits where each square # contains one of the digits 1,2,3,4,5,6,7,8,9. # For this question we will generalize # and simplify the game. #...- doktorwho
- Thread
- Code Python Sudoku
- Replies: 4
- Forum: Programming and Computer Science
-
Python Which of these training websites would you recommend?
I would be really thankful if you could check out them because I'm kinda indecisive about everything and i want your opinion on this. I was looking for a website that would have programming problem sets set in order so i could solve them and also have fun. I'm a python newbie and this is what i...- doktorwho
- Thread
- Programming Python Websites
- Replies: 2
- Forum: Programming and Computer Science
-
Python Why does my code produce incorrect output?
# Use Dave's suggestions to finish your daysBetweenDates # procedure. It will need to take into account leap years # in addition to the correct number of days in each month. def nextDay(year, month, day): n=month if (n==1 or n==3 or n==5 or n==7 or n==8 or n==10 or n==12) and day < 31...- doktorwho
- Thread
- Code Output Python
- Replies: 5
- Forum: Programming and Computer Science
-
S
MATLAB Python to Matlab Conversion for fscanf & DWT
Hello, 1. Homework Statement I find diffuculties to transform fscanf and to apply the discrete wavelet transform order 2 from matla to python. Homework Equations This is the MATLAB code: D_P=fopen('distance_profil.txt','r'); i=0; while(feof(D_P)==0)% test for end of file i=i+1...- Simon_Azerty
- Thread
- Code Matlab Matlab code Matlab programming Python
- Replies: 1
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
Python What Projects Can I Build Using Django?
Hi I am having a hard time finding what specifically Django allows me to do, and why people are using it. I am seeing a lot of places hiring people who know Django. Python is something I already use for mathematical modelling, so I want to try working with Django. I have a website, so I want...- Avatrin
- Thread
- python
- Replies: 1
- Forum: Programming and Computer Science
-
Python Which of these codes do you think is the simplest
Since i don't know how to write code here on forums i will upload a picture and explain what's it about. In the picture there are three codes that define the same procedure of finding the biggest number out of three given. The first code in the picture is defining a procedure called...- doktorwho
- Thread
- beginner code programming python
- Replies: 10
- Forum: Programming and Computer Science
-
N
What are the areas of expertise for NumberSix?
NumberSix solves problems using mathematics and mathematical software. He has worked on gesture recognition, speech recognition, video compression and several other highly mathematical areas. He has expertise in mathematical modeling, statistics, and linear algebra. He has many years of...- NumberSix
- Thread
- C++ Matlab Physics Python
- Replies: 2
- Forum: New Member Introductions
-
Python Which of these code editors would you recommend?
Hi, I am looking to buy a code editor for my iphone so i can code on it. I don't know any of these but they are most if not all paid and i was thinking of asking for your help in choosing one of them. I would like it to be a python editor but it should also support other languages. It is also...- doktorwho
- Thread
- Code Programming Python
- Replies: 10
- Forum: Programming and Computer Science
-
Why Does My Python URL Extraction Code Not Work?
I am suppose to write a code that print put the url of a link given below. The url is defined to start where the first " appears and end where the last " url appears starting from the start_link. Its actually the last project from te lecture 1 in Udacity and the forst code of mine.. but its...- doktorwho
- Thread
- Code Output Python
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
Python What is the best place to learn Python?
What would be your option for learning python? Would it be a book a course a youtube channel.. you name it, whether paid or free it doesn't matter i just want to get an idea of the best place to start..- doktorwho
- Thread
- Language Python
- Replies: 12
- Forum: Programming and Computer Science
-
G
Python Programming an OldMaid Card Game python
I am having trouble removing the same cards from my hand in my game of oldMaid. this is my source: Mod note: Added code tags to preserve indentation, and modified code slightly (replacing index i in arrays with j. deck=[] suits = ['\u2660', '\u2661', '\u2662', '\u2663'] ranks =...- garr6120
- Thread
- Game Programming Python
- Replies: 3
- Forum: Programming and Computer Science
-
R
Python Really simple Python program to simulate inelastic collision
I'm trying to write this Python program that simulates a completely inelastic collision between two objects. The program seems to work for the most part, but I'm completely lost on the "heat released" part at the end. I have no idea if I'm calculating this right, or if I'm completely wrong. Can...- remote
- Thread
- Collision Inelastic Inelastic collision Program Python
- Replies: 2
- Forum: Programming and Computer Science
-
About computers and being good at coding....
i wanted to know how to become computer king of world if we have coding talent like making cool apps,software,making technical software machines like robotics. can we become computer king by challenging bill gates like what they did to world we can do in 1 day not by copying but following...- sukalp
- Thread
- C++ Coding Computers Java Python Ruby
- Replies: 9
- Forum: Programming and Computer Science
-
Python Create a binary search tree in python with the support of variables
My instructor asked us to create a binary search tree in python that supports variables. i.e. the tree will have variables inside, and the user can get the values for those variables by looking for the name of that variable. I don't really know how to implement this. What I have so far: class...- FallArk
- Thread
- Binary Python Search Support Tree Variables
- Replies: 13
- Forum: Programming and Computer Science
-
C/C++ Question about learning C++ Linked Lists before Stacks....
i wanted to ask you that in c++it is important we should learn linked list before learning stack,queue that i wanted to know while studying data structures- sukalp
- Thread
- C++ C++ programming Java Python Rubber band
- Replies: 6
- Forum: Programming and Computer Science
-
Python Help with Python: Implementing Algorithm
My instructor gave out a sample code as listed below: def eval_infix_sum(expr, pos): """evaluate a sum expression (zero or more additions and subtractions) expr Python string list complete expression to be evaluated pos integer...- FallArk
- Thread
- Python
- Replies: 31
- Forum: Programming and Computer Science
-
R
Linux for Physicists: Best Distro for Beginners
I am starting my PhD soon, and I want to properly start learning linux. I have mainly used windows for most of my life, but I have been apart of two research placements using linux mint, where I did simulations attaining to Nano-Photonics. I am curious as to if you guys have any opinion on the...- RobosaurusRex
- Thread
- computing linux programming python research
- Replies: 23
- Forum: Computing and Technology
-
Python Exploring Algorithmic Composition and MIDI Programming with Python
Python is the only programming language I know, and I know there is a huge library of MIDI music out there. I want to play around with machine learning and algorithmic composition to see what I can produce. So, what books should I read to be able to do this? What I am looking for is: Books to...- Avatrin
- Thread
- Algorithm Book recommendations Music Programming Python
- Replies: 1
- Forum: Programming and Computer Science
-
Python Learning Python: IDE or Not for Scientific Computing?
Hello, PF! I've recently begun learning Python the hard way (you know, the online lessons by Zed Shaw), and so far I'm doing great. He does talk down to you at some times, but I don't mind that at all, and he encourages memorizing absurd things, but I like his minimalistic approach at...- MexChemE
- Thread
- Programming Python Scientific computing
- Replies: 13
- Forum: Programming and Computer Science
-
Python Installing Python on Windows 7: Pip, Anaconda, 32-bit or 64-bit?
I get to install Python on a Windows 7 box and have a few questions. In the past I always downloaded Python from python.org and added any additional packages either with pip or downloading and installing from the package's site. Is this the best way or would Anaconda (or something else) be a...- websterling
- Thread
- Python Windows windows 7
- Replies: 4
- Forum: Programming and Computer Science
-
Why wouldn't astronomers use Mathematica?
Mathematica is fully functional for daily astronomy data analyzing works, and it is much more convenient than python, so why can't them use Mathematica instead of python? It's like when you have warp drive you still travel through space using chemically powered traditional rockets, which is...- GW150914
- Thread
- Astronomer Mathematica Python
- Replies: 20
- Forum: STEM Career Guidance
-
S
Python Python Microcontroller: Learn How to Use It
Hello, I ahve used C and C++ assembly lang introduction and few codes. which processor or microcontroller use phyton??- SDRFG
- Thread
- Microcontroller Python
- Replies: 6
- Forum: Programming and Computer Science
-
Python CAMB python convergence power spectrum code
I'm trying to understand this python CAMB code: http://camb.readthedocs.io/en/latest/CAMBdemo.html Scroll down to In[29] and In[30] to see it. It's an integration over chi (comoving distance), yet scipy.integrate.quad is not called. It seems that the fun stuff happens in the last for-loop in...- sunrah
- Thread
- Code Convergence Power Power spectrum Python Spectrum
- Replies: 1
- Forum: Programming and Computer Science
-
Python Doublet + Uniform Flow // Streamfunction Polar Plot Help
Hello, Python,CFD and PF newbie here. I am using Spyder (Python 3.5) and I managed to plot my streamfunction in cartesian coordinates. I tried transforming and plotting in polar coordinates but I am not sure that what i have done is correct. I am not even sure what the plot should look like :/...- nn2e11
- Thread
- Cfd Flow Plot Polar Python Uniform
- Replies: 3
- Forum: Programming and Computer Science