14,948 Topics

Member Avatar for
Member Avatar for dier02

How do you catch incorrect entries? Instead of yes or no the user enters something else? def weather(): import sys raining=input('Is it raining? ').lower() if raining == 'yes': ask =(input('Do you have an umbrella? ')).lower() if raining=='no': print('Go outside 1') sys.exit(0) if ask == 'yes': print('Go outside 2') sys.exit(0) while …

Member Avatar for jnneson
0
392
Member Avatar for Nether_1

Alright so I wrote a little program using Python 2.7 and the pygame module. For some reason, no matter what I do, the actual Pygame screen itself won't flip() or update() at all, no matter what I do. The code's pictured below(it's rather long): import pygame pygame.init() DISPLAY = pygame.display.set_mode((800, …

Member Avatar for Gribouillis
0
229
Member Avatar for Nether_1

Recently I attempted to install Pygame for Python 2.5 on my new computer. The computer runs Windows 10 32-bit, and I have installed a 32 bit copy of Pygame, so there shouldn't be problems there. Whenever I enter my Python shell to attempt to import, this error happens: >>> import …

Member Avatar for Nether_1
0
314
Member Avatar for sabbib

I want to use Tkinter funtion to create a a temperature calculator. I have all the code for the calculator, however using Tkinter function i cant figure out how to get the variable input by the users. I am new to python and programming, just started programming less then a …

Member Avatar for Judith_2
0
1K
Member Avatar for engrjd91

I am new to python, in the below code i am reading 2 files and writing in 2 files. I want to open these files in seperate functions as to make some indented look. Can anyone suggest me how to do it? def compare(): memberReportFile=open("D:\MemberReport.txt", 'w') readableRulesFile=open("D:\ReadableRules.txt", 'w') membersFile=open("D:\Members.txt") rulesFile=open("D:\Rules.txt", …

Member Avatar for slate
0
242
Member Avatar for engrjd91

Hello everyone, I have two files i.e Rules.txt and Members.txt. I have set different rules for different members. Now i have break down the rules comma seperately using the for loop. I want to compare each index of the 1st file with the respective index of the second file. If …

Member Avatar for Gribouillis
0
480
Member Avatar for Lazarus777

Hi, i still learning about python. Now i study learning convert ***bandwidth*** (**Byte**) from `ifconfig eth0`to **Kbps** The problem is, my pc using **os windows 7** not **linux/ubuntu** I dont know how to using command `ifconfig eth0` using win7. Any other way to solved this problem?

Member Avatar for Lazarus777
0
278
Member Avatar for Lucas_9

Please help me , I need to convert this C code in Python: #include<stdio.h> #include<stdlib.h> #include<conio.h> main() { system ("color F9"); float preco[150], precoNF, NFPreco_Produto[150]; //Vetores e variáveis que trabalham com preço int a=0, x=0, v=0, rel=0, y, i, aux, cod_exclui, troca; //Declaração de variáveis utilizadas para leitura, gravação, exlclusão …

Member Avatar for Gribouillis
0
1K
Member Avatar for Izio

Hi there, I need some help to finish that code, In fact, there is one problem in my code : The last line, when i tried to convert a hexadecimal number in int. The problem is, I got variables containing : ff or 00 or C6 etc... And i want …

Member Avatar for Izio
0
342
Member Avatar for Mayukh_1

I have a text file in the form like below sourceFiles { hello.cpp, hi.cpp, main.cpp, } headerFiles { hello.h, hi.h, } path { source [ what, how, which, ] header [ include, inc, head, ] } I need to populate several lists from this text file. So far I have …

Member Avatar for jacks009
0
427
Member Avatar for hjos

I need to make multiple instances of a class, then use its methods to find the output. It is straightforward to write the code in multiple lines but I need a more efficient way of doing that. Basically, here is what I want to do in a loop: class test(object): …

Member Avatar for Gribouillis
0
242
Member Avatar for grand_78

Okay so my code is almost complete but I still need one small thing that I can figure out. When running my code it will add 5 when accelerating and subtract 5 when braking, but I need it to display an error when speed >0 when braking, then reset speed …

0
154
Member Avatar for grand_78

Okay so my code works, but I need a few more requirements for it and I can't seem to get them right even though they should be pretty simple. I just need the window to display an error message when the values entered are not numerical and when the values …

Member Avatar for slate
0
231
Member Avatar for Karthik_4

![Screenshot_from_2016-05-05_10:40:29.png](/attachments/large/4/d1a3b93ed36e54fabc134d4a3a268ccd.png "align-center") I am trying to write a python code to verify for the presence of `.mp3` and corresponding `.json` file in the dropbox. dropboxmp3txt = self.driver.find_element_by_xpath('//android.widget.ListView/android.view.View/android.widget.TextView[contains(@index, "1")]') print dropboxmp3txt.text This gives me the output : `abc2016-05-05, 10.38.26.mp3` Which is perfectly fine!!! I need the similar xpath to find the …

0
155
Member Avatar for templar77

Hi, I'm still practice learning Python. I have a litte homework, make Class method, Class Date and Class Delta without using import. it must be like this... `>>> date(2020, 5, 2) + delta(year=5)` `date(2025, 5, 2)` `>>> date(2020, 5, 2) + delta(month=3)` `date(2020, 8, 2)` `>>> date(2020, 5, 2) + …

Member Avatar for Gribouillis
0
361
Member Avatar for Karthik_4

Hi I have around 20 python files. Each time I run these files in the terminal this form one after another : python a.py python b.py python c.py python d.py python e.py python f.py python g.py . . . (I have provided general file names here) This process takes lot …

Member Avatar for Karthik_4
0
13K
Member Avatar for ALosh99

I have this point in (x,y) : ([27.266378342786531], [1.9505463431334713]) Now I want to use this point(I have many points,I want to know how can I use this point first ) to put it in the function below insted of x :(I have tried to make an array put i don't …

Member Avatar for Gribouillis
0
164
Member Avatar for Mickey_2

I saw someone getting an assignment to implement the Vigenere Cipher, so I decided, just for the frig of it, to implement the Caesar Cipher. The algorithm below, however, doesn't account for spaces and punctuation. How can I account for those without redoing the whole thing? from random import choice …

Member Avatar for Mickey_2
0
281
Member Avatar for OnlyThierry

Hello, I would like to create a chess game GUI but I have a problem with my code. When I run my programm, at the beginning, my code is supposed to read a ".lvl" file to place pieces on the chessboard (same method as in Mario Sokoban). However, it doesn't …

Member Avatar for OnlyThierry
0
3K
Member Avatar for genevish

It's a simple script, giving me an error. I'm running it from a command line: scott$ python VerifyAboutPage.py chrome any And the error is: AttributeError: 'module' object has no attribute 'chrome' The relevant portions of the script should be: from selenium import webdriver import unittest, time, re, reporting, sys class …

Member Avatar for Swapna_1
0
853
Member Avatar for ALosh99

I am trying to plot the picewise function below: rho0 = 3*10e-11 Rd = 3.15 Rc = 7 def Density(rho0, r, Rc, Rd): if r < Rc : return rho0 elif r> Rc : return rho0*np.exp(-(r-Rc)/Rd) r = np.linspace(0,20, 1000) y= Density(rho0, r, Rc, Rd) plt.plot(r, y) plt.show() I am …

Member Avatar for ALosh99
0
869
Member Avatar for Mickey_2

Onager Ornery Clicker presents a grid of buttons. One says "Click Me!" and the rest say "Don't Click Me!" Clicking the right button scores a point, while clicking the wrong button costs a point. After each click the buttons reshuffle. There is a timer you can start and stop. You …

Member Avatar for Mickey_2
0
288
Member Avatar for Mickey_2

I'm developing a dirt-simple text editor for personal use, customized the way I like it. My biggest difficulty is with grasping how OOP works. Could you kindly review the following code and suggest improvements (or at least link further information)? Much appreciated. from tkinter import Tk, END, INSERT from tkinter.scrolledtext …

Member Avatar for John_103
0
289
Member Avatar for neerajkumar_86

Hi I have some python file.i runs these file one by one as below on unix server. python f4761sk3.py python f4761sk2.py python f4761sk1.py python f4761se3.py python f4761se2.py python f4761se1.py python f4761pl3.py python f4761pl2.py python f4761pl1.py python f4761no3.py python f4761no2.py python f4761no1.py python f4761nl3.py python f4761nl2.py python f4761nl1.py python f4761ie3.py python …

Member Avatar for Gribouillis
0
2K
Member Avatar for pirulo64

I'm trying to use a "python loop through list" and execute a command on each line from the list found and in between sleep to give it time to finish that command. Here my script. I know it's the basic, but some one can help me to help me in …

Member Avatar for pirulo64
0
277
Member Avatar for Mickey_2

This script is to be a 5x5 grid of buttons, one saying "Click Me" and the rest "Don't Click Me." A correct click scores a point, an incorrect click costs a point. The buttons get shuffled after each click. The player has 60 seconds to maximize his score. The script …

Member Avatar for Mickey_2
0
4K
Member Avatar for zero_1

How to combine two class? so the output can be equal... here's my code.. class year: def __add__(self, year): return (year) class day: def __add__(self, day): return (day) class month: def __add__(self, month): return (month) class Date: def __call__(self, year, month, day): return (year, month, day) class Delta(year, month, day): …

Member Avatar for zero_1
0
315
Member Avatar for btp06b

# This program converts US measurements # to metric measurements. # Constants for valid values VALID_VALUE = 0 MAX_TEMP = 1000 def main(): print(''' 1.Miles to Kilometers. 2.Farenheit to Celsius. 3.Gallons to Liters. 4.Pounds to Kilograms. 5.Inches to centimeters. 6.Exit. ''') input('What would you like to convert?') if selection == …

Member Avatar for Freshly
0
491
Member Avatar for firdevs

question: write in python to take five input values and output: a)the highest value b)the lowest value c)the average (i need help with my homework)

Member Avatar for slate
0
158
Member Avatar for Mickey_2

What software do you recommend for drawing layouts to be implemented in a ttk application? I'm looking for something simple and clutter-free where there aren't 10 zillion options I don't want. All I really need is basic shapes corresponding to the shapes of ttk widgets and a way to place …

Member Avatar for slate
0
127

The End.