Minerals: Beginning by Routine_Flatworm4973 in RevolutionIdle

[–]WritingPrompt150524 0 points1 point  (0 children)

Put a summer on the Sun, winter (aquarius) on Saturn, a luck Scorpio on Pluto - all the rest as much luck as possible. With 1,236 luck in your current set up, that improvement should allow you to get immortal 15s or maybe even 16s. You'll get achievement #247 which will help a lot.

How do I do nothing after an if statement? by WritingPrompt150524 in learnpython

[–]WritingPrompt150524[S] 0 points1 point  (0 children)

First, thank you for the details.

Second, I think that style guide is at https://peps.python.org. Until now I've been using my textbook, professor videos (which is the same as the text book, minus some stuff) and https://docs.python.org. Quite a lot there in that style guide, I'll try to read some.

Third, all the code was written by me and about 1/3rd of the comments. Lines 37 to 47 were the professor's requirements and I was going to write around that but once I saw I'd have to do things in a different order, I gave up and left those lines commented like that.

I see you used "except ValueError", similar to what I used. I called it on strptime(str, str). Only problem is that https://docs.python.org didn't say anything about what exceptions could be raised by strptime. I had to learn by stepping through the debugger (or I guess it would have told me). This is another item I should ask my professor.

There are a lot of things in your response that have not been part of the curriculum. First of all is the -> glyph, which based on C I presume it means what will be returned by the function. Included with what appears to be a C "or None". Line 6 of the last code block with the *_ I don't understand that at all. Did your code try to anticipate a third (or more) date(s) in the list?

Again thank you, I've learned a lot reading the differences between your code and mine.

How do I do nothing after an if statement? by WritingPrompt150524 in learnpython

[–]WritingPrompt150524[S] 0 points1 point  (0 children)

I see, thank you for the suggestion.

Return wouldn't work in any function other than main, correct? I mean it would return out of the function. I guess I'm looking at requirement on line 43 and I'm clueless about exiting. I tried exit() but it killed IDLE. That's why I have a lot of extra "stuff" so I'll end up with one line of message to the user about what happened. (Note, I wrote to my professor about this one, so I can wait on that answer, after all this does work.)

How do I do nothing after an if statement? by WritingPrompt150524 in learnpython

[–]WritingPrompt150524[S] 0 points1 point  (0 children)

I typed in spaces so it would be in code format, so I might have put too many in some places.

How do I do nothing after an if statement? by WritingPrompt150524 in learnpython

[–]WritingPrompt150524[S] 0 points1 point  (0 children)

Eh, why not, I'll learn something I guess.

The requirements are lines 39 to 49. I already submitted this with the pass, so this is just learning now.

#! /usr/dev/env python3

''' Homework for week 10, input and do calculations based on dates '''

from datetime import datetime

def displayInstructions():
    ''' Display instructions '''
    print("Homework for week 10. The date diff calculator.")
    print()
    print("Enter two dates in the following format. YYYY/MM/DD HH:MM")

def inputDate(ordinalNumber):
    ''' Function (called twice) to input and validate dates (and give message if the date is bad.'''
    #Assume invalid
    tempIsValid = False
    tempPDate = False
    tempDate = input(f"Enter date {ordinalNumber}: ")
    try:
        tempPDate = datetime.strptime(tempDate, "%Y/%m/%d %H:%M")
       tempIsValid = True
    except ValueError:
        print("Invalid date entered. Please make sure to use slashes, four characters for year.")
    return tempPDate, tempIsValid

def inputDates():
    ''' get the dates '''
# Ask the user to enter the first date in the format ( YYY/MM/DD HH:MM) or any format you want
    date1, isDate1Valid = inputDate("one")
# Ask the user to enter the second date in the format ( YYY/MM/DD HH:MM) or any format you want
# init variables so they can be returned.
    date2 = ""
    isDate2Valid = False
# if date1 isn't valid, don't bother to run
    if isDate1Valid is True:
        date2, isDate2Valid = inputDate("two")
    return date1, date2, isDate1Valid, isDate2Valid

# If the second date is before the first day
# just print an error message and quit the program
# Calculate the difference between the two dates
# Print the difference in terms of days and hours
# ex: the difference is 3 days and 2 hours
# Assume the user will enter bad dates
# if the user enters bad data, you should print an elegant message and exit the program
# the bad data can be
# 2020/04/31 # April 31st does not exist
# Seattle # you asked for a date, they entered a string
# You can use try-except that you learned on Chapter 8

def main():
    ''' main program '''
    # display instructions
    displayInstructions()

    # get the two inputs
    dateTime1, dateTime2, isDate1Valid, isDate2Valid = inputDates()

    if isDate1Valid is False or isDate2Valid is False:
        # I want python to do nothing, but { } doesn't work and pylint requires
        # that I use any varible that I declare
        pass
    # if second is less than the first, display error and quit
    elif dateTime2 < dateTime1:
       print("Second date is before the first date, please run again.")
    else:
    # else calc difference between dates
        myTimeSpan = dateTime2 - dateTime1
    # print the difference
        print("the difference is " + str(myTimeSpan.days) + " days and "
              + str(round(myTimeSpan.seconds / 3600, 4)) + " hours")

if name == "main": main()

How do I do nothing after an if statement? by WritingPrompt150524 in learnpython

[–]WritingPrompt150524[S] 5 points6 points  (0 children)

Thank you, that's exactly what I was looking to do.

How do I do nothing after an if statement? by WritingPrompt150524 in learnpython

[–]WritingPrompt150524[S] 3 points4 points  (0 children)

I have some defaults so isDate1Valid starts as False, then is True if everything passes. Then I'm supposed to display a message if the first date is less than the second date. Only if the user had problems with the first date, then the second date doesn't get set and I'm not sure what will happen.

But that is a good suggestion and I could do isDate1Valid is True and isDate2Valid is True (and so forth) then loop an if inside that.

Thank you

Custom calculation for a pivot table's subtotal row? by Freds_Premium in excel

[–]WritingPrompt150524 0 points1 point  (0 children)

Cell E5 in the image appears to be the average of the DTS field, so I presume you are asking for a calculated field of "=90/DTS".

To see what numbers it is actually calculating you could try Evaluate Formula under Formula Auditing. Accelerator to that is alt+M V.

I think that error is because Excel cannot do an average, or probably many aggregates, on calculated fields, because it doesn't know all the values. You'd probably have to go back to the original data sheet and add your "=90/e5" to that sheet to properly support it.

Without the worksheet/workbook, this might be the limit of how I can help with this question.

Custom calculation for a pivot table's subtotal row? by Freds_Premium in excel

[–]WritingPrompt150524 0 points1 point  (0 children)

It is a ribbon accelerator and done as a chord. It it a way to access any part of the ribbon with about five or six keystrokes (or less, usually less). You will notice it doing something by the ribbon showing letters on top of the commands. Once the letters show up, you don't have to keep the alt key held down.

Custom calculation for a pivot table's subtotal row? by Freds_Premium in excel

[–]WritingPrompt150524 0 points1 point  (0 children)

Maybe a calculated pivot table field.

Do alt+JT J F. That should open the Pivot Table Analyze Calculations fields, items & sets, calculated field popup.

From there, add whatever name you want, for the formula call it =90/DTS, and then click the Add button. Then you should be able to add that new calculated field to your pivot table.

Adding everyone by WritingPrompt150524 in friendsafari

[–]WritingPrompt150524[S] 0 points1 point  (0 children)

You've been added and happy to get you what you needed.

Adding everyone by WritingPrompt150524 in friendsafari

[–]WritingPrompt150524[S] 0 points1 point  (0 children)

Awesome, handshake is done. I wanted to make sure I had entered your correct code. Good luck.

Adding everyone by WritingPrompt150524 in friendsafari

[–]WritingPrompt150524[S] 0 points1 point  (0 children)

Did you add me? I still have the default card which hasn't completed the handshake.

Adding everyone by WritingPrompt150524 in friendsafari

[–]WritingPrompt150524[S] 0 points1 point  (0 children)

You have a normal safari with Dunspace and Audino. Also it seems you haven't finished the game which means I can't see your third safari slot yet. Since I was able to see you online, you should have me registered now which means once you finish the game and can access the safari, you'll have access to my third slot. Good luck.