Re: [Tutor] HELP PLEASE

2019-08-13 Thread Alan Gauld via Tutor
On 13/08/2019 12:09, Sithembewena L. Dube wrote: > Hi Marissa, > > I really think that you could consider doing an introductory Python > tutorial and then venture back into solving this problem. >>> This is the output of my updated code: >>> Traceback (most recent call last): >>> File "/Applicat

Re: [Tutor] HELP PLEASE

2019-08-13 Thread Sithembewena L. Dube
Hi Marissa, I really think that you could consider doing an introductory Python tutorial and then venture back into solving this problem. Understanding concepts like data types, function syntax and loops makes all the difference in approaching programming challenges. Here is a decent and free on

Re: [Tutor] HELP PLEASE

2019-08-13 Thread Cameron Simpson
On 12Aug2019 15:11, Marissa Russo wrote: This is my code: Thank you. This is the output of my updated code: Traceback (most recent call last): File "/Applications/Python 3.7/exercises .py", line 37, in main() File "/Applications/Python 3.7/exercises .py", line 33, in main m = mean(d

Re: [Tutor] HELP PLEASE

2019-08-13 Thread David L Neil
On 13/08/19 7:11 AM, Marissa Russo wrote: This is my code: import math def get_numbers(): print("This program will compute the mean and standard deviation") file1 = input("Please enter the first filename: ") file2 = input("Please enter the second filename: ") x = open(file1,

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Marissa Russo
This is my code: import math def get_numbers(): print("This program will compute the mean and standard deviation") file1 = input("Please enter the first filename: ") file2 = input("Please enter the second filename: ") x = open(file1, "r") y = open(file2, "r") nums = x.read

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Mats Wichmann
On 8/12/19 10:54 AM, Marissa Russo wrote: > Hello, > > I am trying to figure out what is going on and why my output is saying > “” instead of giving me a number. Please let me know if > you see the error in my code!! to quickly illustrate the specific question you asked - you got comments on ot

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Alan Gauld via Tutor
On 12/08/2019 17:54, Marissa Russo wrote: > def mean(nums): > for num in nums: > _sum += num > return _sum / len(nums) > > def mean2(nums2): > for num in nums2: > _sum += nums2 > return _sum / len(nums2) > > def main(): > data = get_numbers() > > print("T

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Sithembewena L. Dube
In your calls to the `*print*` function, you are not calling the `*mean*` and `*mean2*` functions that you declared to calculate averages. So Python sees you trying to concatenate two function objects to strings and is not happy. That's one thing. Secondly, your code could be refactored to define

Re: [Tutor] HELP PLEASE

2019-08-12 Thread Joel Goldstick
On Mon, Aug 12, 2019 at 1:22 PM Marissa Russo wrote: > > Hello, > > I am trying to figure out what is going on and why my output is saying > “” instead of giving me a number. Please let me know if > you see the error in my code!! > Marissa, you have lots of problems here. First, you should cop

[Tutor] HELP PLEASE

2019-08-12 Thread Marissa Russo
Hello, I am trying to figure out what is going on and why my output is saying “” instead of giving me a number. Please let me know if you see the error in my code!! import math def get_numbers(): print("This program will compute the mean and standard deviation") file1 = input("Please e

Re: [Tutor] Help request ERROR installing beautifulsoup

2019-04-29 Thread Mats Wichmann
On 4/29/19 1:44 AM, Alan Gauld via Tutor wrote: > On 28/04/2019 17:11, Dr. Luca T wrote: > ^ >> SyntaxError: Missing parentheses in call to 'print'. Did you mean >> print("Unit tests have failed!")? >> > >> I use windows 10,

Re: [Tutor] Help request ERROR installing beautifulsoup

2019-04-29 Thread Alan Gauld via Tutor
On 28/04/2019 17:11, Dr. Luca T wrote: ^ > SyntaxError: Missing parentheses in call to 'print'. Did you mean > print("Unit tests have failed!")? > > I use windows 10, python 3.7.3 ... The problem is you are running python 2

Re: [Tutor] Help request ERROR installing beautifulsoup

2019-04-29 Thread Peter Otten
Dr. Luca T wrote: > Hi, > i'm new in python, i tried to install beautifulsoup but i had back this > error: > > ERROR: Complete output from command python setup.py egg_info: > ERROR: Traceback (most recent call last): > File "", line 1, in > File > "C:\Users\Luca\AppData\Loc

[Tutor] Help request ERROR installing beautifulsoup

2019-04-29 Thread Dr. Luca T
Hi, i'm new in python, i tried to install beautifulsoup but i had back this error: ERROR: Complete output from command python setup.py egg_info: ERROR: Traceback (most recent call last): File "", line 1, in File "C:\Users\Luca\AppData\Local\Temp\pip-install-u6zd808q\beautifulsoup

Re: [Tutor] help with colormode

2019-04-25 Thread Alan Gauld via Tutor
On 25/04/2019 11:54, Mark Alderson wrote: > tried screen.colormode(255) Peter has shown you how to make that work but there is a wee issue below I need to point out. > -code- > from turtle import Turtle > t = Turtle() > t.speed(0) > > b = 180

Re: [Tutor] help with colormode

2019-04-25 Thread Peter Otten
Mark Alderson wrote: > hi > > Ihave a very small program. I want to cycle colours. I cant set the > colormode from 1 to 255 > > tried screen.colormode(255) > > tells me screen is not defined. the program works without the colormode, > but i want to use it. > > I just change the a and b vari

[Tutor] help with colormode

2019-04-25 Thread Mark Alderson
hi Ihave a very small program. I want to cycle colours. I cant set the colormode from 1 to 255 tried screen.colormode(255) tells me screen is not defined. the program works without the colormode, but i want to use it. I just change the a and b variable values to generate new art.

Re: [Tutor] Help

2019-04-18 Thread fatima butt
Hi Peter, Thanks soo much ...Its solved...have a nice day ! On Wed, 17 Apr 2019 at 22:48, Peter Otten <__pete...@web.de> wrote: > fatima butt wrote: > > > hi Peter, > > hope you are well.I am getting the following error when i am running the > > pygame shell script.I am using Acer SWIFT computer.

Re: [Tutor] Help

2019-04-17 Thread Peter Otten
fatima butt wrote: > hi Peter, > hope you are well.I am getting the following error when i am running the > pygame shell script.I am using Acer SWIFT computer.my python version is > 3.7.3 and pygame version is pygame 1.9.5 > > Traceback (most recent call last): > File "C:\Users\ammah\OneDrive\D

[Tutor] Help

2019-04-17 Thread fatima butt
hi Peter, hope you are well.I am getting the following error when i am running the pygame shell script.I am using Acer SWIFT computer.my python version is 3.7.3 and pygame version is pygame 1.9.5 Traceback (most recent call last): File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py",

[Tutor] Help

2019-04-17 Thread fatima butt
hi Peter, hope you are well.I am getting the following error when i am running the pygame shell script.I am using Acer SWIFT computer.my python version is 3.7.3 and pygame version is pygame 1.9.5 Traceback (most recent call last): File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py",

Re: [Tutor] Help with code

2019-03-28 Thread Alan Gauld via Tutor
On 28/03/2019 21:12, lucasbreault2...@gmail.com wrote: > I’m trying to make a password that must contain a number in it. I assume you mean you want to check whether a password has a number in it? Does it need to be a single digit or can there be multiple? > Which method do I use for that? There

[Tutor] Help with code

2019-03-28 Thread lucasbreault2400
I’m trying to make a password that must contain a number in it. Which method do I use for that? Sent from my iPhone ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help

2019-03-20 Thread Alan Gauld via Tutor
On 20/03/19 14:30, Eric Oh Yeah Yeah wrote: How do I make Python 3 pick a random variable out of a set of variables I give it? There are several options but if you look in the random module you should find one that suits your particular needs. choice() or randrange() may be good options. If

[Tutor] Help

2019-03-20 Thread Eric Oh Yeah Yeah
How do I make Python 3 pick a random variable out of a set of variables I give it? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help Please

2019-02-21 Thread DL Neil
Mario, On 21/02/19 3:30 AM, Mario Ontiveros wrote: Hello, I am new to python and have been stuck on this for a while. What I am trying to do is to remove rows with void, disconnected, and error on lines. The code I have does that, the only problem is that it removes my header because voi

Re: [Tutor] Help Please

2019-02-20 Thread Alex Kleider
On 2019-02-20 06:30, Mario Ontiveros wrote: Hello, I am new to python and have been stuck on this for a while. What I am trying to do is to remove rows with void, disconnected, and error on lines. The code I have does that, the only problem is that it removes my header because void is in head

Re: [Tutor] Help Please

2019-02-20 Thread Alan Gauld via Tutor
On 20/02/2019 14:30, Mario Ontiveros wrote: > Hello, > I am new to python and have been stuck on this for a while. What I am > trying to do is to remove rows with void, disconnected, and error on lines. > The code I have does that, the only problem is that it removes my header > because void

Re: [Tutor] Help Please

2019-02-20 Thread Mark Lawrence
On 20/02/2019 14:30, Mario Ontiveros wrote: Hello, I am new to python and have been stuck on this for a while. What I am trying to do is to remove rows with void, disconnected, and error on lines. The code I have does that, the only problem is that it removes my header because void is in

[Tutor] Help Please

2019-02-20 Thread Mario Ontiveros
Hello, I am new to python and have been stuck on this for a while. What I am trying to do is to remove rows with void, disconnected, and error on lines. The code I have does that, the only problem is that it removes my header because void is in header. I need to keep header. Any help will b

Re: [Tutor] help

2019-02-05 Thread Alan Gauld via Tutor
On 05/02/2019 14:15, Peter Otten wrote: >> Error: >> ./python2.py: line 1: syntax error near unexpected token `(' > > That is not a Python error, that's a complaint of your shell. Oh, good catch Peter. I never noticed the start of the line I just read the text and saw the weird backtick... --

Re: [Tutor] help

2019-02-05 Thread Mats Wichmann
>> Error: >> ./python2.py: line 1: syntax error near unexpected token `(' > > That is not a Python error, that's a complaint of your shell. > If you make a Python script executable you also have to insert the proper > hash-bang line. In the case of Python 2 > > #!/usr/bin/python2 > > will pro

Re: [Tutor] help

2019-02-05 Thread Peter Otten
Sonia Miglani wrote: > Hi Team, > > I am learning puthon and trying the following code. > > But getting the following error. > > Please help me in knowing the code in better way. > > > OS Linux > Python version 2.7.13 > > > > def demo(s, exclaim): > #""" > # Returns the string 's'

Re: [Tutor] help

2019-02-05 Thread Alan Gauld via Tutor
On 05/02/2019 12:32, Sonia Miglani wrote: > OS Linux > Python version 2.7.13 Can you tell us how you are creating the file? Which editor are you using? It looks like there may be some spurious characters in your file. > def demo(s, exclaim): > #""" > # Returns the string 's' repeated 3 t

[Tutor] help

2019-02-05 Thread Sonia Miglani
Hi Team, I am learning puthon and trying the following code. But getting the following error. Please help me in knowing the code in better way. OS Linux Python version 2.7.13 def demo(s, exclaim): #""" # Returns the string 's' repeated 3 times. # If exclaim is true, add exclamati

Re: [Tutor] Help please

2018-10-12 Thread Alan Gauld via Tutor
On 12/10/18 04:31, Adam Eyring wrote: > Also, it looks better to use " + " instead of a comma: > print("Combining these foods will you," + new_food) It may "look better" but be aware that they don't do the same thing and the plus sign is a lot less efficient computationally since it creates a new

Re: [Tutor] Help please

2018-10-12 Thread Mark Lawrence
On 12/10/18 04:31, Adam Eyring wrote: The program works as is in Python3. For Python2, change input to raw_input and see if that makes it work (I know it worked for me when I had Python2). Also, it looks better to use " + " instead of a comma: print("Combining these foods will you," + new_food)

Re: [Tutor] Help please

2018-10-12 Thread Adam Eyring
The program works as is in Python3. For Python2, change input to raw_input and see if that makes it work (I know it worked for me when I had Python2). Also, it looks better to use " + " instead of a comma: print("Combining these foods will you," + new_food) Also, colons and spaces are good practic

Re: [Tutor] Help please

2018-10-11 Thread Carlton Banks
https://www.w3schools.com/python/ref_func_input.asp tor. 11. okt. 2018 18.51 skrev Carlton Banks : > What are you trying to do? > > tor. 11. okt. 2018 18.33 skrev Holly Jo : > >> >> I have no clue what I’m doing wrong, I’m a new student >> >> food_1=input("Sushi") >> food_2=input("Quesdilla") >>

Re: [Tutor] Help please

2018-10-11 Thread Carlton Banks
What are you trying to do? tor. 11. okt. 2018 18.33 skrev Holly Jo : > > I have no clue what I’m doing wrong, I’m a new student > > food_1=input("Sushi") > food_2=input("Quesdilla") > new_food=food_1+food_2 > print("Combining these foods will you,",new_food) > input("Press enter to continue") > >

Re: [Tutor] Help please

2018-10-11 Thread Alan Gauld via Tutor
On 11/10/18 04:19, Holly Jo wrote: > > I have no clue what I’m doing wrong, I’m a new student > > food_1=input("Sushi") > food_2=input("Quesdilla") > new_food=food_1+food_2 > print("Combining these foods will you,",new_food) > input("Press enter to continue") Please always tell us what has gon

[Tutor] Help please

2018-10-11 Thread Holly Jo
I have no clue what I’m doing wrong, I’m a new student food_1=input("Sushi") food_2=input("Quesdilla") new_food=food_1+food_2 print("Combining these foods will you,",new_food) input("Press enter to continue") Sent from Mail for Windows 10 ___ Tutor

Re: [Tutor] help please

2018-10-10 Thread Mirage Web Studio
You are using the same variable name twice. You may use "rivers" for the dict and "river" for values. Also use descriptive names for variables. For eg if you correct the above mistake, the next one will be this line for rivers in rivers.values(): print (rivers) and sorry for top positing.

Re: [Tutor] help please

2018-10-10 Thread Deepak Dixit
On Wed, Oct 10, 2018, 12:37 PM Michael Schmitt wrote: > To whom it may concern: > > > I am trying to teach myself Python and ran into a problem. This is my code > > > # name of rivers and country > > rivers = {'nile' : 'egypt', 'ohio' : 'US', 'rhine' : 'germany' } > > # prints river name > for ri

Re: [Tutor] help please

2018-10-10 Thread Abdur-Rahmaan Janhangeer
i think it should have been for river in rivers instead of for rivers in rivers Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.pyth

Re: [Tutor] help please

2018-10-10 Thread Peter Otten
Michael Schmitt wrote: > To whom it may concern: > > > I am trying to teach myself Python and ran into a problem. This is my code > I am getting the following error > for rivers in rivers.values(): > AttributeError: 'str' object has no attribute 'values' > # prints river name > for rivers in

[Tutor] help please

2018-10-10 Thread Michael Schmitt
To whom it may concern: I am trying to teach myself Python and ran into a problem. This is my code # name of rivers and country rivers = {'nile' : 'egypt', 'ohio' : 'US', 'rhine' : 'germany' } # prints river name for rivers in rivers.keys(): print (rivers) #prints country for rivers in r

Re: [Tutor] Help understanding base64 decoding

2018-09-13 Thread Cameron Simpson
On 13Sep2018 08:23, Ryan Smith wrote: [...] I'm still getting familiar with all of the different encodings at play. For example the way I currently understand things is that python supports unicode which ultimately defaults to being encoded in UTF-8. Hence I'm guessing is the reason for convert

Re: [Tutor] Help understanding base64 decoding

2018-09-13 Thread Ryan Smith
Hi Peter, Thank you for the explanation! I have been banging my head around this for almost two days. I'm still getting familiar with all of the different encodings at play. For example the way I currently understand things is that python supports unicode which ultimately defaults to being encoded

Re: [Tutor] Help understanding base64 decoding

2018-09-13 Thread Peter Otten
Ryan Smith wrote: > Hello All, > > I am currently working on a small utility that finds any base64 > encoded strings in files and decodes them. I am having issue > understanding how the Base64 module actually works. The regular > expression that I am using correctly matches on the encoded strings

[Tutor] Help understanding base64 decoding

2018-09-12 Thread Ryan Smith
Hello All, I am currently working on a small utility that finds any base64 encoded strings in files and decodes them. I am having issue understanding how the Base64 module actually works. The regular expression that I am using correctly matches on the encoded strings. I simply want to be able to c

Re: [Tutor] Help with building bytearray arrays

2018-09-11 Thread Peter Otten
Chip Wachob wrote: > Peter, > > I see that clue "[[". > > The thread history pretty much sums up what is going on up to this point. > > I'll cover it once more: [snip] > I hope this helps. Unfortunately it doesn't as the problem is in my_transfer. > I'm beginning to wonder if Python was th

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Alan Gauld via Tutor
On 10/09/18 19:15, Chip Wachob wrote: > So I see why my .join() isn't working. I'm not sure how to fix it though. I already showed you the sum() function. It can take a list of lists and add them together end_array = sum(results,[]) > My background is in C and other 'historical' languages, so

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Cameron Simpson
On 10Sep2018 10:23, Chip Wachob wrote: So, without all the fluff associated with wiggling lines, my function now looks like this: def RSI_size_the_loop(): results = [] all_together = [] # not certain if I need this, put it in in an attempt to fix the incompatibility if it existed You do

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Chip Wachob
Peter, I see that clue "[[". The thread history pretty much sums up what is going on up to this point. I'll cover it once more: I'm using Adafruit FT232H Breakout board and Adafruit's library. https://github.com/adafruit/Adafruit_Python_GPIO Per Adafruit's example code, I create an SPI inter

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Peter Otten
Chip Wachob wrote: > Cameron, > > Thank you again for the insight. > > Yes, data_out is an equivalently-sized 'chunk' of a larger array. > > I'm 'getting' this now.. > > So, without all the fluff associated with wiggling lines, my function > now looks like this: > > def RSI_size_the_loop(): >

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Chip Wachob
Cameron, Thank you again for the insight. Yes, data_out is an equivalently-sized 'chunk' of a larger array. I'm 'getting' this now.. So, without all the fluff associated with wiggling lines, my function now looks like this: def RSI_size_the_loop(): results = [] all_together = [] # not

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Alan Gauld via Tutor
On 10/09/18 04:00, Chip Wachob wrote: > I presume that I need to instantiate an array of slice_size-sized bytearrays. Cameron has already addressed this and explained that you don't need to and if you did how to do it. I'd only add that you need to readjust your thinking when it comes to Python

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Cameron Simpson
On 09Sep2018 23:00, Chip Wachob wrote: On Sat, Sep 8, 2018 at 9:14 PM, Cameron Simpson wrote: Actually he's getting back bytearray instances from transfer and wants to join them up (his function does a few small transfers to work around an issue with one big transfer). His earlier code is just

Re: [Tutor] Help with building bytearray arrays

2018-09-10 Thread Chip Wachob
On Sat, Sep 8, 2018 at 9:14 PM, Cameron Simpson wrote: > On 08Sep2018 11:40, Alan Gauld wrote: >> >> On 08/09/18 03:15, Chip Wachob wrote: >>> >>> Ideally, I'd like to take the slice_size chunks that have been read >>> and concatenate them back togetjer into a long MAX_LOOP_COUNT size >>> array t

Re: [Tutor] Help with building bytearray arrays

2018-09-09 Thread Cameron Simpson
On 09Sep2018 17:06, Chip Wachob wrote: Before I jump in, the 1000 foot view is I have to send an array of 512 bytes down the SPI loop, and read back 512 bytes that were latched in from a control interface. Unfortunately, there's a glitch in the FTDI part and I can't just send the 512 bytes.. th

Re: [Tutor] Help with building bytearray arrays

2018-09-09 Thread Chip Wachob
Cameron, et al. First off, thank you for being patient with me. I'm not used to the email list communication style. Since Cameron's response was the one that raised the most questions / comments, I'm going to reply to it. Inline.. now that I know that this is the preferred method... Before I j

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Cameron Simpson
On 08Sep2018 11:40, Alan Gauld wrote: On 08/09/18 03:15, Chip Wachob wrote: Ideally, I'd like to take the slice_size chunks that have been read and concatenate them back togetjer into a long MAX_LOOP_COUNT size array to pass back to the rest of my code. Eg: You need to create a list of read_

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Cameron Simpson
On 08Sep2018 20:01, Cameron Simpson wrote: So, if I'm understanding the transfer() function correctly, the function takes and returns a bytearray type. It would be good to see the specification for the transfer function. They we can adhere to its requirements. Can you supply a URL? I see yo

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 03:15, Chip Wachob wrote: > my function's main pieces are: It would probably be better to post the entire function, a partial code sample like this just gives us an inkling of what you are trying to do but not enough to be sure of where the errors lie. > def transfer_byte_array(): >

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 03:15, Chip Wachob wrote: > Admin, please remove my earlier messages. No can do, once the emails are sent by the server they are out there on the net, stored in people's mailboxes and in various internet archives. When using a mailing list always check before sending, there's no going

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Alan Gauld via Tutor
On 08/09/18 04:57, Chip Wachob wrote: > was my attempt at 'setting' the type of the variable. A variable in Python is just a name. It has no type. Only values have types. So you can set (or change) the type of a value but not of a variable. > Coming from a 'C' background, I find the lack of ty

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Cameron Simpson
Please try to adopt the inline reply style; we prefer it here. It lets us reply point by point and makes messages read like conversations. Anyway... On 07Sep2018 23:57, Chip Wachob wrote: Point taken on 'bytes'.. thanks. the scratch_ary = bytearray() was my attempt at 'setting' the type of

Re: [Tutor] Help with building bytearray arrays

2018-09-08 Thread Chip Wachob
Point taken on 'bytes'.. thanks. the scratch_ary = bytearray() was my attempt at 'setting' the type of the variable. I had hoped that it would help resolve the error messages telling me that the types didn't go together. Coming from a 'C' background, I find the lack of typing in Python to be

[Tutor] Help with building bytearray arrays

2018-09-08 Thread Chip Wachob
Admin, please remove my earlier messages. This message is a properly 'self contained' message. Hello, I've been struggling with this for the last day or so and I can't seem to figure out how to make it work. I'll start out by saying that if there's a better approach, then I'm all ears. I'm usi

Re: [Tutor] Help with building bytearray arrays

2018-09-07 Thread Cameron Simpson
On 07Sep2018 15:45, Chip Wachob wrote: Basically I'm trying to write a block of unsigned bytes to the device and read back an equal sized block of unsigned bytes. There's a function that is provided called transfer(data_to_send, num_of_bytes) that handles the heavy lifting. Unfortunately there

[Tutor] Help with building bytearray arrays

2018-09-07 Thread Chip Wachob
Hello, I've been struggling with this for the last day or so and I can't seem to figure out how to make it work. I'll start out by saying that if there's a better approach, then I'm all ears. I'm using the Adafruit Breakout board for the FTDI FT232H part. Along with this comes the Python librar

Re: [Tutor] help with reading a string?

2018-07-16 Thread Steven D'Aprano
Hi Crystal, and welcome! My response is further below, after your question. On Mon, Jul 16, 2018 at 05:28:37PM -0500, Crystal Frommert wrote: > Hi, I am a beginner comp sci teacher at an all-girls high school. The girls > are learning how to read from a txt file and search for a string. > > Here

Re: [Tutor] help with reading a string?

2018-07-16 Thread Alan Gauld via Tutor
On 16/07/18 23:28, Crystal Frommert wrote: > are learning how to read from a txt file and search for a string. > > Here is a sample of text from the txt file: > TX,F,1910,Mary,895 > TX,F,1910,Ruby,314 > TX,F,1910,Annie,277 > > How do they read the number after a certain searched name and then ad

[Tutor] help with reading a string?

2018-07-16 Thread Crystal Frommert
Hi, I am a beginner comp sci teacher at an all-girls high school. The girls are learning how to read from a txt file and search for a string. Here is a sample of text from the txt file: TX,F,1910,Mary,895 TX,F,1910,Ruby,314 TX,F,1910,Annie,277 TX,F,1910,Willie,260 TX,F,1910,Ruth,252 TX,F,1910,Glad

Re: [Tutor] Help

2018-07-03 Thread Alan Gauld via Tutor
On 03/07/18 06:23, Adam Jones wrote: > Good day, I am currently checking a piece of arcpy code. Where a point is > shifted within a set distance to protect the privacy of said point. Please > see the code below, and please advise me or correct the code where it is > needed It would help us to help

[Tutor] Help

2018-07-03 Thread Adam Jones
Good day, I am currently checking a piece of arcpy code. Where a point is shifted within a set distance to protect the privacy of said point. Please see the code below, and please advise me or correct the code where it is needed # Step 11 - SELECT By Attributes -> where FID == FID_1, export to new

Re: [Tutor] help with Pandas

2018-05-22 Thread Alan Gauld via Tutor
On 22/05/18 18:13, Glenn Schultz wrote: Cavbeat: I'm no dataframe expert so I'm going on general principles here... > I am trying to apply the function to the data frame as follows: > > df['loanage'].apply(myfunction(x = 2, y = 10, z = 10, df['loanage]), axis = 0) This looks wrong on several

[Tutor] help with Pandas

2018-05-22 Thread Glenn Schultz
All, I have a dataframe with the column 'loanage' and a function to transform loanage, which will be part of a pipline, I am trying to apply the function to the data frame as follows: df['loanage'].apply(myfunction(x = 2, y = 10, z = 10, df['loanage]), axis = 0) I get value error: The truth i

Re: [Tutor] Help

2018-05-16 Thread Alan Gauld via Tutor
On 16/05/18 02:43, Steven D'Aprano wrote: > The traceback Sam posted says (in part): > > Move = input('What Will You Do? Fight or Run: ') > File "", line 1, in > NameError: name 'Run' is not defined > > so the failed line was the call to input(). In Python 3, it would return > a string.

Re: [Tutor] Help

2018-05-15 Thread Steven D'Aprano
On Tue, May 15, 2018 at 08:01:13PM -0500, boB Stepp wrote: > On Tue, May 15, 2018 at 7:51 PM, Steven D'Aprano wrote: > > > You also seem to be using Python 2. In Python 2, you should never use > > the input() function. Instead, use raw_input() instead. > > What are you seeing that suggests the O

Re: [Tutor] Help

2018-05-15 Thread boB Stepp
On Tue, May 15, 2018 at 7:51 PM, Steven D'Aprano wrote: > You also seem to be using Python 2. In Python 2, you should never use > the input() function. Instead, use raw_input() instead. What are you seeing that suggests the OP is using Python 2? I am missing what you are seeing/understanding.

Re: [Tutor] Help

2018-05-15 Thread Steven D'Aprano
On Tue, May 15, 2018 at 02:49:54PM -0500, Sam Hoffman wrote: > Traceback (most recent call last): > File "/Users/samhoffman/Documents/test.py", line 54, in > Battle() > File "/Users/samhoffman/Documents/test.py", line 41, in Battle > Move = input('What Will You Do? Fight or Run: ') >

Re: [Tutor] Help

2018-05-15 Thread boB Stepp
Greetings! On Tue, May 15, 2018 at 2:49 PM, Sam Hoffman wrote: > Traceback (most recent call last): > File "/Users/samhoffman/Documents/test.py", line 54, in > Battle() > File "/Users/samhoffman/Documents/test.py", line 41, in Battle > Move = input('What Will You Do? Fight or Run: ')

[Tutor] Help

2018-05-15 Thread Sam Hoffman
Traceback (most recent call last): File "/Users/samhoffman/Documents/test.py", line 54, in Battle() File "/Users/samhoffman/Documents/test.py", line 41, in Battle Move = input('What Will You Do? Fight or Run: ') File "", line 1, in NameError: name 'Run' is not defined import time

Re: [Tutor] Help with loops

2018-05-01 Thread Isaac Tetteh
else: print("Could not give {} to {}".format(i[1],i[0])) Let us know if you have any other questions. Isaac, Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 From: Tutor on behalf of Shannon Evans vi

Re: [Tutor] Help with loops

2018-04-30 Thread Alan Gauld via Tutor
On 30/04/18 14:35, Shannon Evans via Tutor wrote: > Hi, is there any way that i can add a loop or iteration or something so > that i dont have to write out every person who has fruit. Yes that's what loops are for. You have two options in Python: a 'for' loop or a 'while' loop In your case I sus

[Tutor] Help with loops

2018-04-30 Thread Shannon Evans via Tutor
Hi, is there any way that i can add a loop or iteration or something so that i dont have to write out every person who has fruit. This information is coming from the following json files: *queue.json* file [ ["James Bruce", "Bananas"], ["Katherine Newton", "Bananas"], ["Deborah Garcia", "

Re: [Tutor] Help!

2018-04-19 Thread Neil Cerutti
On 2018-04-19, Steven D'Aprano wrote: > Some program ideas... > > Encrypt and decrypt text using a Caesar Cipher. > > https://en.wikipedia.org/wiki/Caesar_cipher > > or one of many other simple ciphers. > > Calculate the prime numbers up to a certain limit. > > https://en.wikipedia.org/wiki/Sieve_

Re: [Tutor] Help!

2018-04-19 Thread Steven D'Aprano
Hello Joshua, and welcome! My comments below. On Thu, Apr 19, 2018 at 01:15:59AM +, Joshua Nghe wrote: > Hi, > This is Joshua N from Campus Middle School. You are talking to people from all over the world, and some of us are not familiar with what you mean by "Middle School". What is it? A

[Tutor] Help!

2018-04-19 Thread Joshua Nghe
Hi, This is Joshua N from Campus Middle School. In my science class, we are learning topics of our choice. I chose coding as my project, and I am contacting you to ask about certain projects which would be appropriate for a programmer at a beginner level. I only have 15 hours on Python, however

Re: [Tutor] Help with a task

2018-04-12 Thread Alan Gauld via Tutor
On 12/04/18 11:54, Aditya Mukherjee wrote: > Hello, I'm relatively new to python and have been given a task for > university, and would greatly appreciate if anyone could help me basically > just get started because as of now I am completely clueless and have no > idea what to do. I don't really kn

Re: [Tutor] Help with a task

2018-04-12 Thread David Rock
> On Apr 12, 2018, at 05:54, Aditya Mukherjee > wrote: > > Helping me getting started and just understanding what I actually need to > do would be vastly helpful, as I've heard from other students that they > have over 200 lines. :) > > I've attached the premise of what the task is asking for,

[Tutor] Help with a task

2018-04-12 Thread Aditya Mukherjee
Hello, I'm relatively new to python and have been given a task for university, and would greatly appreciate if anyone could help me basically just get started because as of now I am completely clueless and have no idea what to do. I don't really know who to ask, but anything would be of assistance.

Re: [Tutor] help with code

2018-03-11 Thread Abdur-Rahmaan Janhangeer
print 30 * "-" , "MENU" , 30 * "-" # just tested in py3 you can do # 'MENU'.center(67, '-') On Sun, Mar 11, 2018 at 8:20 AM, Leslie SimondeMontfort via Tutor < tutor@python.org> wrote: > Hi, I wondered if there is someone that can help me with this code. Thank > you, Leslie > > ## Text menu in

Re: [Tutor] help with code

2018-03-11 Thread Bob Gailer
On Mar 11, 2018 6:25 AM, "Leslie SimondeMontfort via Tutor" < tutor@python.org> wrote: > > Hi, I wondered if there is someone that can help me with this code. I have to assume that you are very new to python. Have you written a Python program that runs the way you want it to? It is often useful t

Re: [Tutor] help with code

2018-03-11 Thread Cameron Simpson
On 10Mar2018 23:20, Leslie SimondeMontfort wrote: Hi, I wondered if there is someone that can help me with this code. Thank you, Leslie Generally we like to know what you think is wrong with it. For example, what you expected it to do, and a little transcript of what it actually did (cut/p

Re: [Tutor] help with code

2018-03-11 Thread Alan Gauld via Tutor
On 11/03/18 04:20, Leslie SimondeMontfort via Tutor wrote: > Hi, I wondered if there is someone that can help me with this code. I'll try but theres a lot to comment on. See below... > def print_menu(): ## Your menu design here > print 30 * "-" , "MENU" , 30 * "-" > print "1. Menu

Re: [Tutor] help with code

2018-03-11 Thread Joel Goldstick
On Sat, Mar 10, 2018 at 11:20 PM, Leslie SimondeMontfort via Tutor < tutor@python.org> wrote: > Hi, I wondered if there is someone that can help me with this code. Thank > you, Leslie > > ## Text menu in Python > > def print_menu(): ## Your menu design here > print 30 * "-" , "MENU" , 3

[Tutor] help with code

2018-03-11 Thread Leslie SimondeMontfort via Tutor
Hi, I wondered if there is someone that can help me with this code. Thank you, Leslie ## Text menu in Python def print_menu(): ## Your menu design here print 30 * "-" , "MENU" , 30 * "-" print "1. Menu login 1" print "2. Menu create an account 2" print "3. Menu list all ac

  1   2   3   4   5   6   7   8   9   10   >