Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Aligning values in arrays
Post: Aligning values in arrays
Let's say I want to see if the first item in one string is the same first item as the second string in the array. Or, I want to check if the last item of the first string aligns with the last item of ... |
|
pav1983 |
General Coding Help |
2 |
1,742 |
Jun-30-2020, 09:07 PM |
|
|
Thread: Exercism not working
Post: RE: Exercism not working
I finally got it to work. |
|
pav1983 |
Bar |
2 |
4,784 |
Jun-28-2020, 02:56 AM |
|
|
Thread: How to calculate the year by adding n months?
Post: RE: How to calculate the year by adding n months?
Sorry if I drove you crazy. I really do appreciate it that you took the time to try and help me. Your help is always appreciated.
def after_n_months(year, month):
try:
return year + (month //... |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 08:27 PM |
|
|
Thread: How to calculate the year by adding n months?
Post: RE: How to calculate the year by adding n months?
(Jun-27-2020, 07:31 PM)ndc85430 Wrote: If you know these facts, then the problem is pretty trivial to solve. Look at the first example you gave:
after_n_months(2020, 24) ➞ 2022
Given what you said... |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 08:09 PM |
|
|
Thread: How to calculate the year by adding n months?
Post: RE: How to calculate the year by adding n months?
(Jun-27-2020, 07:20 PM)ndc85430 Wrote: OK, fair enough. This calculation is really really simple though. If you have 24 months, how many years does that correspond to? What about 30?
I completely ag... |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 07:27 PM |
|
|
Thread: How to calculate the year by adding n months?
Post: RE: How to calculate the year by adding n months?
(Jun-27-2020, 07:13 PM)ndc85430 Wrote: If there are 12 months in a year, why do you think you need to multiply your number of months by 12? If month has a value of 24, then as you've written it, yea... |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 07:17 PM |
|
|
Thread: How to calculate the year by adding n months?
Post: RE: How to calculate the year by adding n months?
(Jun-27-2020, 07:06 PM)ndc85430 Wrote: How many months are in a year? Given a number of months, how can you work out how many years that corresponds to? This really isn't something that should take ... |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 07:10 PM |
|
|
Thread: How to calculate the year by adding n months?
Post: RE: How to calculate the year by adding n months?
(Jun-27-2020, 06:50 PM)ndc85430 Wrote: Well, remember that % gives you the remainder after division, so any multiple of 12 will satisfy that condition.
OK. I get what you guys are saying about the ... |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 07:03 PM |
|
|
Thread: How to calculate the year by adding n months?
Post: RE: How to calculate the year by adding n months?
(Jun-27-2020, 06:26 PM)ndc85430 Wrote: Express in words what you're checking on line 2. Does it make sense to increment year by 1 whenever that is true?
I thought it was because 12 months = 1 year. |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 06:36 PM |
|
|
Thread: How to calculate the year by adding n months?
Post: RE: After N Months
(Jun-27-2020, 06:13 PM)ndc85430 Wrote: What is causing you difficulty? Given a year and a number of months, how would you work out what the new year should be? It's a pretty trivial problem.
def aft... |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 06:18 PM |
|
|
Thread: How to calculate the year by adding n months?
Post: How to calculate the year by adding n months?
Hi Everyone,
I've successfully solved many problems. I'm even starting to solve some in the 'easy' category on Edabit. However, this 'very easy' problem seems harder than the category says. I'm re... |
|
pav1983 |
Homework |
19 |
5,664 |
Jun-27-2020, 06:11 PM |
|
|
Thread: What am I doing wrong to not get the answer
Post: RE: What am I doing wrong to not get the answer
(Jun-25-2020, 05:03 PM)ndc85430 Wrote: Is there a way you could look at the characters in the string to help you determine what you need to do? Look up the methods that you can use on strings to hel... |
|
pav1983 |
Homework |
7 |
3,686 |
Jun-25-2020, 08:38 PM |
|
|
Thread: What am I doing wrong to not get the answer
Post: RE: What am I doing wrong to not get the answer
(Jun-25-2020, 04:53 PM)ndc85430 Wrote: You need to compare the values for equality, surely?
That's what it says. But the question is 'how'? There's where I'm lost. I don't understand what to do i... |
|
pav1983 |
Homework |
7 |
3,686 |
Jun-25-2020, 04:55 PM |
|
|
Thread: What am I doing wrong to not get the answer
Post: RE: What am I doing wrong to not get the answer
(Jun-25-2020, 03:25 PM)ndc85430 Wrote: Of course it doesn't work for the equals case, because a single = in Python means assignment and you can't assign to a literal, can you?
An = just sets a varia... |
|
pav1983 |
Homework |
7 |
3,686 |
Jun-25-2020, 03:29 PM |
|
|
Thread: What am I doing wrong to not get the answer
Post: What am I doing wrong to not get the answer
In this challenge you will be given a relation between two numbers, written as a string.
Here are some example inputs:
"2 = 2", "8 < 7", "5 = 13", "15 > 4"
Write a function that determines if ... |
|
pav1983 |
Homework |
7 |
3,686 |
Jun-25-2020, 03:21 PM |
|
|
Thread: Return the sum of the first n numbers in the list.
Post: RE: Return the sum of the first n numbers in the l...
Thanks for you help, but I figured it out without setting the variables. I forgot it was the sum of the first n numbers.
def sum_first_n_nums(lst, n):
if n <= len(lst):
return sum(lst[0:n])
e... |
|
pav1983 |
Homework |
3 |
4,045 |
Jun-24-2020, 02:50 AM |
|
|
Thread: Return the sum of the first n numbers in the list.
Post: Return the sum of the first n numbers in the list.
Hi, I am stuck on this one. It makes no sense to me. I did attempt, but I'm having no luck. I think it comes down to knowing how to get the first n numbers of the list. Below is my code so far. I... |
|
pav1983 |
Homework |
3 |
4,045 |
Jun-24-2020, 02:22 AM |
|
|
Thread: Increase text size and change color based on temp
Post: RE: Increase text size and change color based on t...
This is what I came up with, but it didn't work.
def getWeather():
#Replace YOURAPIKEYHERE with the API key you obtain by signing up at https://openweathermap.org/
api_address = 'http://api.o... |
|
pav1983 |
GUI |
5 |
3,170 |
Jun-22-2020, 10:40 PM |
|
|
Thread: Increase text size and change color based on temp
Post: RE: Increase text size and change color based on t...
Thank you. SO far so good. Now I just want to learn how to change the color in the little box based on the temperature. I know what colors I want. I just want to know how to do it so that I can do... |
|
pav1983 |
GUI |
5 |
3,170 |
Jun-22-2020, 10:14 PM |
|
|
Thread: Increase text size and change color based on temp
Post: Increase text size and change color based on temp
I have a weather app I want to do something with. I've adapted it from somehwere else and would like to adapt it further, but I am not sure how to adapt it.
Here are the two things I would like to... |
|
pav1983 |
GUI |
5 |
3,170 |
Jun-22-2020, 09:52 PM |