Hi, I'm trying to infintley print random numbers. I have the code to print infintley, but not to print a random number (completely random, no pattern). Does anyone have the code to print a list of numbers completely at random?

Member Avatar
Member Avatar
+0 forum 1

I am trying to build a GUI app for graph plotting where graph can be shown as a slideshow so that the data can be clearly visualised. First I wish to plot a set of data then after a specific time interval next set of data and so on. I have a text file contains data as: 0.00 -10.742 10.7888 6.33455 1.00 -17.75391 10.0000 4.66778 4.00 -19.62891 15.9999 4.232323 20.00 -20.7641 18.6666 3.99999 23.00 -34.2300 2.7777 2.00000 50.00 -50.000 1.87878 2.77778 65.88 -22.5000 2.99999 1.45555 78.00 -30.000 1.55555 2.45667 86.00 -37.7900 2.55556 7.55679 90.00 -45.00000 13.6667 2.677888 ---- ---- 200.02 …

Member Avatar
Member Avatar
+0 forum 1

I have four ordinary differential equation written in mathmatica : Simplify[DSolve[{y1'[x] == -0.162y1[x], y2'[x]=-0.148 y2[x]+ 0.055y1[x],y3'[x]==-0.134 y3[x]+ 0.033y1[x]+ 0.039y2[x],y4'[x]==-0.125y4[x]+0.021 y1[x]+0.025y2[x]+ 0.043y3[x], y1[0] == 100,y2[0]==4.76,y3[0]==69.7,y4[0]==0}, {y1[x], y2[x],y3[x],y4[x]}, x]] I am trying to write them in python I have try the following : def n1(y,x): s1 = 0.162131 dydx = -s1 * y return dydx def n2(y,x): s2 = 0.148234 s12= 0.0555877 dydx2 = -s2 * y + s12 * n1(y,x) return dydx2 def n3(y,x): s3 = 0.134337 s13= 0.0333526 s23= 0.0389114 dydx3 = -s3 * y + s13 * n1(y,x) + s23 * n2(y,x) return dydx3 def n4(y,x): s4= 0.125072 s14= …

Member Avatar
+0 forum 0

I'm trying to create a platformer with tkinter, i've created the character and now i'm trying to create a dynamic background with a biomes system so when the player passes from a biome to another the background changes the image. from tkinter import * from PIL import Image, ImageTk from random import * current_image = None path_img_1 = "assets/background/notte.png" # images path path_img_2 = "assets/background/Hills Layer 01.png" def move_oval(oval, canvas, master, increase=2): # move the ball x1, y1, x2, y2 = canvas.coords(oval) if x1 <= 0: increase = 2 elif x2 >= canvas_width: increase = -2 x1 += increase x2 …

Member Avatar
Member Avatar
+0 forum 1

I can not get this program to list all of the contact names, it just list the first one. ##!/usr/bin/evn python3 # # Contact Manager Program # import csv FILENAME = "contacts.csv" def write_contacts(contacts): with open (FILENAME, "w", newline="") as file: writer = csv.writer(file) writer.writerows(contacts) def read_contacts(): contacts = [] with open(FILENAME, newline="") as file: reader = csv.reader(file) for row in reader: contacts.append(row) return contacts def list_contacts(contacts): for i in range(len(contacts)): contact = contacts[i] print(str(i+1) + "." + contact[0] ) print() def view_contacts(contacts): number = int(input("Number: ")) if number < 1 or number > len (contacts): print("invalid number") else: contact …

Member Avatar
Member Avatar
+0 forum 2

I am trying to implement Connect 4 game using Min-Max as utility to find best possible move.<br><br> The game is played on a 6x7 grid, with six rows and seven columns. . The two players take turns placing pieces on the board: the red player can only place red pieces, and the green player can only place green pieces. It is best to think of the board as standing upright. We will assign a number to every row and column, as follows: columns are numbered from left to right, with numbers 1, 2, ..., 7. Rows are numbered from bottom …

Member Avatar
Member Avatar
+0 forum 1

An example showing how to use the wx.media.MediaCtrl() widget to play MIDI, MP3, WAV, AU, AVI and MPG audio and video files. I have only tested it with Windows. If you are very ambitious, you could use a random graphics display with the sound, or tie the slider position to a slide presentation.

Member Avatar
Member Avatar
+2 forum 7

Please assit to translate the following code from python to php [Click Here](https://www.dropbox.com/s/qndlm9qenvge6sf/pyussd.rar) Thank you

Member Avatar
Member Avatar
+0 forum 4

Hello, I found this code in a thread from about 18 months ago in a post by 'woooee' - [CODE]def func_1(): print " func_1 test" def func_2(): print " func_2 test" def func_3(): print " func_3 test" def func_4(): print " func_4 test" ##---------------------------------------------------------------- ## dictionary = list of function to call and menu choice to print menu_d = { 1:['func_1()', '1)Load'], 2:['func_2()', '2)Save'], 3:['func_3()', '3)Add Phone Number'], 4:['func_4()', '4)View Phone Number'], 5:["", "5)Exit"]} choice = 0 while choice != 5: print "\nSelect an Option\n" for j in range(1, 6): print menu_d[j][1] ## print list's element #1 for key=j choice …

Member Avatar
Member Avatar
+0 forum 8

I've been tasked with this assignment: > In a graphics window, you are to draw an outdoor scene containing a house. > Your drawing should include at least the following shapes: three rectangles, two lines, one circle and one text label > Your picture should not be boring black and white. It should include at least three colors, tastefully distributed to bring your house to life. > Finally, it should have some interactive feature such that when a user clicks on your picture something changes (e.g. a color changes, a tree falls over, the sun rises, a door opens). The …

Member Avatar
Member Avatar
+0 forum 2

Hello there ! Which python books do you recommend for system programming?

Member Avatar
Member Avatar
+0 forum 3

Hello everyone, I am a learner, who found this helpful community where one's query is satisfied in so many great ways. I have one such query regarding Recursion. Can anyone help me to know about the effects of Recursion in Python? Does it cause any trouble?

Member Avatar
Member Avatar
+0 forum 7

**Create a student class which has following functionality:** - Initialise a student with mandatory parameters - Create a student with name, email and phone number - Add a list of subjects based on which class he is - Add a function to calculate his percentage based on marks scored ***I have written C++ code of student database. I want python code so please anyone write in python and share asap.*** Thanks in advance :-)

Member Avatar
Member Avatar
-1 forum 14

Is there any need for overloading operators in python?

Member Avatar
Member Avatar
+0 forum 2

I couldn't install the tensorflow framework in my laptop.can anyone help me out in installing tensorflow for doing my project on deep learning techniques.

Member Avatar
Member Avatar
+0 forum 1

This short Python code gets the local time from the PC as a formatted string using time.strftime('%H:%M:%S'). The time string is displayed in a label using a larger font. A recursive function checks the time five times per second, and updates the time string, if it has changed. Five times per second may sound like overkill, but keeps the display from acting spasmodic.

Member Avatar
Member Avatar
+2 forum 13

Hi everyone, i am in need of ideas and want a bit of advise...i want to make a serial port sniffer which will be able to read the data goin in and out of the serial port between two other programs..... im not sure how i will be able to access a port when its already open....:confused: all advises are heartily welcome Thank you....

Member Avatar
Member Avatar
+0 forum 10

Years ago I wrote a program in Fortran for a structural analysis class. At the time I had very little programming experience and mottled my way through the assignment. Fast forward to now and I'm attempting to teach myself Python 3. I figured I'd would try to convert the old program from Fortran to Python. I've made some good progress but I've hit a wall. I've got the program running to the point where all the element stiffness matrices are defined and combined into the structure stiffness matrix using the code number technique. The structure stiffness matrix is triangular. At …

Member Avatar
Member Avatar
+0 forum 7

Hi, I have created a quiz whixh displays an artist and the first letter of their song and the user has to guess the song. However, I need help looping the quiz so it displays another artists if the user has anwered correctly after their first or second guess. Thank You score=0 import random def random_line(songs): lines =open("songs.txt").read().splitlines() return random.choice(lines) print(random_line("songs.txt")) guess1=input("please enter your first guess:\n") found = False with open('answers.txt') as file: for line in file: line = line.strip() if guess1== line: print("Your answer is correct") found = True score = score + 3 print("You score is ",score,"points") break …

Member Avatar
Member Avatar
+0 forum 1

Hello all, I was wondering if I could get some questions answered about how cupons work in the work place. I have an idea which involves creating a very flexible cupon service, but would require knowing the rudiments of how cupons work. The main question I have is how is tax calculated on a ware as it is sold under a cupon service. I believe that would be the only thing I would have to stringently mandate as far as the cupon goes, since the institution wishes to clear the merchendise from the floor. The service would involve some C# …

Member Avatar
Member Avatar
+0 forum 3

HI All! I need to have some help. I have a python function name is abc.py and variable is declared in abc.py, variable name is 'uname'. How can i call variable name 'uname' of abc.py in my batch file name testing.bat and get uname value in my batch testing.bat file? Best Regards Sarfraz

Member Avatar
Member Avatar
+0 forum 8

![code_error.png](/attachments/large/4/0618569524bcc2abec40e81e5691d469.png) I'm relatively new to python, and I'm trying to create a pokemon battle. This error has come up, I've looked up solutions but it hasn't helped me as I can't understand it properly. Please help, I'd like to learn especially since I'm planning on taking IT and computer science for GCSEs. Thank you in advance.

Member Avatar
Member Avatar
+0 forum 5

i am here ![Screen_Shot_2018-12-28_at_6_47_38_PM.png](/attachments/large/4/237abffd6067e29aa8bd690c2c1a74ec.png) i want to merge all rowsof 3 rd col so that output looks like... end result should be.... ![Screen_Shot_2018-12-28_at_6_49_34_PM.png](/attachments/large/4/92adfc647020ab9265f7d7248758c82f.png)

Member Avatar
Member Avatar
+0 forum 2

i didnt have3 a question

Member Avatar
Member Avatar
+0 forum 2

Let's say you want to send a short private message to your friend, but don't want grandma to snoop around and find it. One way is to use the Python Image Library (PIL) and hide the message in a picture file's pixels. Just looking at the picture you will barely detect any difference between the before and after picture. All your friend needs is the decode_image portion of this simple code to get the message back.

Member Avatar
Member Avatar
+5 forum 15

Hello, I need help on getting solution for the below python code. The code gives the required output which is that it dispaly number of prime number that user wants. if user inputs 4 Actual Output: 2, 3 , 5 , 7 The main question is that I do not have idea on how to give rank to those prime numbers. For Example: The 1st prime number is 2 The 2nd prime number is 3 The 3rd prime number is 5 The 4th prime number is 7 and so on. Can anyone please help to write the code to get …

Member Avatar
Member Avatar
+0 forum 2

import csv import xlwt import os import sys #import openpyxl # Look for input file in same location as script file: inputfilename = os.path.join(os.path.dirname(sys.argv[0]), 'book2.txt') # Strip off the path basefilename = os.path.basename(inputfilename) # Strip off the extension basefilename_noext = os.path.splitext(basefilename)[0] # Get the path of the input file as the target output path targetoutputpath = os.path.dirname(inputfilename) # Generate the output filename outputfilename = os.path.join(targetoutputpath, basefilename_noext+'.xls') # Create a workbook object workbook = xlwt.Workbook() # Add a sheet object worksheet = workbook.add_sheet(basefilename_noext, cell_overwrite_ok=True) # Get a CSV reader object set up for reading the input file with tab delimiters datareader …

Member Avatar
+0 forum 0

How can I locally save an image using its URL address?

Member Avatar
Member Avatar
+1 forum 4

What is the difference between the term Shallow copy and Deep?

Member Avatar
Member Avatar
+0 forum 4

Initially, I've a simple program to print out the whole output to the console. **Initial Code to display output in the console only** import os, subprocess print("1. Before") os.system('ver') subprocess.run('whoami') print('\n2. After') **Output in console** 1. Before Microsoft Windows [Version 10] user01 2. After Then, I decided to have a copy on a log file (log.txt) too while maintaining the original output to the console. So, this is the new code. import os, subprocess, sys old_stdout = sys.stdout log_file = open("log.txt","w") sys.stdout = log_file print("1. Before") # This appear in message.log only, but NOT in console os.system('ver') # This appear …

Member Avatar
Member Avatar
+0 forum 1

The End.