Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Hide symbol or characters in regular expression
Post: Hide symbol or characters in regular expression

I'm trying to find a full list of domain names from a imported text file and the correct regular expression used is this import re hand = open('mbox-short.txt') for line in hand: line = line.rstr...
Gateux General Coding Help 0 2,269 Mar-21-2020, 10:25 AM
    Thread: How do i append into dict?
Post: How do i append into dict?

for x in range(3): patientlist = {} patientname =input('Enter new name: ') patientlist["Patient Name:"] = patientname print(patientname)The above code prompts for input 3 times but when t...
Gateux General Coding Help 12 4,587 Aug-21-2019, 04:22 AM
    Thread: need help with math functions
Post: need help with math functions

Hi I have these two codes here that i need to use math.sqrt for the 1st code and math.pow for the 2nd code, can anyone guide me how to do it? x = 100 * (((f/i) ** (1.0/n)) -1) b = i * ((1 + (x/100)) ...
Gateux General Coding Help 1 1,596 Aug-03-2019, 12:16 PM
    Thread: Need help with isdigit() and isalpha() function
Post: Need help with isdigit() and isalpha() function

I need to write a program that has these conditions: - Length must be exactly 9 - The first letter must be S, T, F or G - Must consist of 7 digits - Reference letter must be A to Z or a to z Expected...
Gateux Homework 2 1,767 Jul-22-2019, 11:46 AM
    Thread: How will you improve my code?
Post: How will you improve my code?

I'm new to Python programming and right now i'm practicing past year assignment before school starts and my codes are fully functioning but it's in a big mess in terms of structure and there are certa...
Gateux Homework 4 2,385 Jul-17-2019, 02:35 PM
    Thread: Need to generate random numbers
Post: RE: Need to generate random numbers

import random def main(): n = int(input("Enter number: ")) random.shuffle(n) for i in range(n): print(i)I get error: Error:for i in reversed(range(1, len(x))): TypeError: object of type 'int' ha...
Gateux General Coding Help 8 3,944 Jul-16-2019, 01:43 PM
    Thread: Need to generate random numbers
Post: RE: Need to generate random numbers

def main(): n = int(input("Enter number: ")) for i in range(1, n + 1): myList = [i] print(myList, end =" ")If I enter the int 5, I get the output as [1] [2] [3] [4] [5] but I want the numbers to...
Gateux General Coding Help 8 3,944 Jul-16-2019, 11:42 AM
    Thread: Need to generate random numbers
Post: RE: Need to generate random numbers

I'm trying to develop a program where the user can enter any integer e.g 7 and then a random sequence of whole numbers from 1 to that number is then generated, e.g., 5 2 4 1 6 7 3. e.g number = int(i...
Gateux General Coding Help 8 3,944 Jul-16-2019, 10:55 AM
    Thread: Need to generate random numbers
Post: Need to generate random numbers

Hi I am trying to generate a random sequence of numbers base on user input but right now I only know of this code: import random def main(): list = [1, 2, 3, 4, 5] test = random.choice(list) print...
Gateux General Coding Help 8 3,944 Jul-16-2019, 09:45 AM
    Thread: Need help with coin change program
Post: Need help with coin change program

Write a program that reads an input representing a change which is an amount less than 1 dollar. The program calculates the change into 50, 10, 5 and 1 cent coins. The program then ...
Gateux Homework 2 6,032 Jun-24-2019, 01:20 PM
    Thread: Need guidance on String indexing
Post: Need guidance on String indexing

Am learning Python for school and reading a Python textbook, I come across one part that I don't understand. >>> grades = ['A', 'B', 'C', 'D', 'F'] >>> grades[2:4] ['C', 'D']Going b...
Gateux Homework 3 2,152 Jun-22-2019, 10:38 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020