content
stringlengths
7
1.05M
description = '' pages = ['header'] def setup(data): pass def test(data): navigate('http://store.demoqa.com/') header.verify_product_categories('Accessories, iMacs, iPads, iPhones, iPods, MacBooks') capture('Verify product categories') def teardown(data): pass
while True: e = str(input()).split() a = int(e[0]) b = int(e[1]) if a == 0 == b: break print(2 * a - b)
# # PySNMP MIB module CISCO-LWAPP-LINKTEST-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-LINKTEST-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:05:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") Counter32, Counter64, Bits, iso, ObjectIdentity, ModuleIdentity, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, Integer32, TimeTicks, IpAddress, NotificationType, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Counter64", "Bits", "iso", "ObjectIdentity", "ModuleIdentity", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "Integer32", "TimeTicks", "IpAddress", "NotificationType", "MibIdentifier") MacAddress, TruthValue, DisplayString, TimeInterval, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "MacAddress", "TruthValue", "DisplayString", "TimeInterval", "TextualConvention", "RowStatus") ciscoLwappLinkTestMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 516)) ciscoLwappLinkTestMIB.setRevisions(('2006-04-06 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setRevisionsDescriptions(('Initial version of this MIB module. ',)) if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setLastUpdated('200604060000Z') if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setOrganization('Cisco Systems Inc.') if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setContactInfo(' Cisco Systems, Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS Email: cs-wnbu-snmp@cisco.com') if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setDescription("This MIB is intended to be implemented on all those devices operating as Central controllers, that terminate the Light Weight Access Point Protocol tunnel from Cisco Light-weight LWAPP Access Points. Link Test is performed to learn the radio link quality between AP and Client. CCX linktest is performed for CCX clients. With CCX linktest radio link can be measured in both direction i.e. AP->Client(downLink) and Client->AP(uplink). When client does not support CCX or CCX linktest fails,ping is done between AP and Client. In ping test, only uplink (client->AP) quality can be measured. The relationship between the controller and the LWAPP APs is depicted as follows. +......+ +......+ +......+ +......+ + + + + + + + + + CC + + CC + + CC + + CC + + + + + + + + + +......+ +......+ +......+ +......+ .. . . . .. . . . . . . . . . . . . . . . . . . . . . . . +......+ +......+ +......+ +......+ +......+ + + + + + + + + + + + AP + + AP + + AP + + AP + + AP + + + + + + + + + + + +......+ +......+ +......+ +......+ +......+ . . . . . . . . . . . . . . . . . . . . . . . . +......+ +......+ +......+ +......+ +......+ + + + + + + + + + + + MN + + MN + + MN + + MN + + MN + + + + + + + + + + + +......+ +......+ +......+ +......+ +......+ The LWAPP tunnel exists between the controller and the APs. The MNs communicate with the APs through the protocol defined by the 802.11 standard. LWAPP APs, upon bootup, discover and join one of the controllers and forward all the 802.11 frames to them encapsulated inside LWAPP frames. GLOSSARY Access Point ( AP ) An entity that contains an 802.11 medium access control ( MAC ) and physical layer ( PHY ) interface and provides access to the distribution services via the wireless medium for associated clients. LWAPP APs encapsulate all the 802.11 frames in LWAPP frames and sends them to the controller to which it is logically connected. Central Controller ( CC ) The central entity that terminates the LWAPP protocol tunnel from the LWAPP APs. Throughout this MIB, this entity also referred to as 'controller'. Cisco Compatible eXtensions (CCX) Wireless LAN Access Points (APs) manufactured by Cisco Systems have features and capabilities beyond those in related standards (e.g., IEEE 802.11 suite of standards, Wi-Fi recommendations by WECA, 802.1X security suite, etc). A number of features provide higher performance. For example, Cisco AP transmits a specific Information Element, which the clients adapt to for enhanced performance. Similarly, a number of features are implemented by means of proprietary Information Elements, which Cisco clients use in specific ways to carry out tasks above and beyond the standard.Other examples of feature categories are roaming and power saving. Light Weight Access Point Protocol ( LWAPP ) This is a generic protocol that defines the communication between the Access Points and the Central controller. Mobile Node ( MN ) A roaming 802.11 wireless device in a wireless network associated with an access point. Mobile Node and client are used interchangeably. Received Signal Strength Indicator ( RSSI ) A measure of the strength of the signal as observed by the entity that received it, expressed in 'dbm'. Signal-Noise Ratio ( SNR ) A measure of the quality of the signal relative to the strength of noise expressed in 'dB'. REFERENCE [1] Wireless LAN Medium Access Control ( MAC ) and Physical Layer ( PHY ) Specifications. [2] Draft-obara-capwap-lwapp-00.txt, IETF Light Weight Access Point Protocol ") ciscoLwappLinkTestMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 0)) ciscoLwappLinkTestMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1)) ciscoLwappLinkTestMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2)) ciscoLwappLinkTestConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1)) ciscoLwappLinkTestRun = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2)) ciscoLwappLinkTestStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3)) cLLtResponder = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 1), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cLLtResponder.setStatus('current') if mibBuilder.loadTexts: cLLtResponder.setDescription("This object is used to control the AP's response to the linktests initiated by the client. When set to 'true', the AP is expected to respond to the linktests performed by the client. The AP won't respond to the linktests initiated by the client, when this object is set to 'false'. ") cLLtPacketSize = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 1500)).clone(50)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cLLtPacketSize.setStatus('current') if mibBuilder.loadTexts: cLLtPacketSize.setDescription('This object indicates the number of bytes to be sent by the AP to the client in one linktest packet. ') cLLtNumberOfPackets = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 100)).clone(20)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cLLtNumberOfPackets.setStatus('current') if mibBuilder.loadTexts: cLLtNumberOfPackets.setDescription('This object indicates the number of linktest packets sent by the AP to the client. ') cLLtTestPurgeTime = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(15, 1800)).clone(15)).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: cLLtTestPurgeTime.setStatus('current') if mibBuilder.loadTexts: cLLtTestPurgeTime.setDescription('This object indicates the duration for which the results of a particular run of linktest is available in cLLtClientLtResultsTable from the time of completion of that run of linktest. At the expiry of this time after the completion of the linktest, the entries corresponding to the linktest and the corresponding results are removed from cLLtClientLinkTestTable and cLLtClientLtResultsTable respectively. ') cLLtClientLinkTestTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1), ) if mibBuilder.loadTexts: cLLtClientLinkTestTable.setStatus('current') if mibBuilder.loadTexts: cLLtClientLinkTestTable.setDescription("This table is used to initiate linktests between an AP and one of its associated clients. CCX linktests are done on clients that support CCX. For all non-CCX clients, ping test is done. Note that ping test is also done when the CCX linktests fail. With CCX LinkTest support, the controller can test the link quality in downstream (direction of traffic from AP to client) direction by issuing LinkTest requests towards the client and let client record in the response packet the RF parameters like received signal strength, signal-to-noise etc., of the received request packet. With ping test only those RF parameters that are seen by the AP are measured. User initiates one run of linktest by adding a row to this table through explicit management action from the network manager. A row is created by specifying cLLtClientLtIndex, cLLtClientLtMacAddress and setting the RowStatus object to 'createAndGo'. This indicates the the request made to start the linktest on the client identified by cLLtClientLtMacAddress. cLLtClientLtIndex identifies the particular instance of the test. The added row is deleted by setting the corresponding instance of the RowStatus object to 'destroy'. In case if the agent finds that the time duration represented by cLLtTestPurgeTime has elapsed since the completion of the linktest, it proceeds to delete the row automatically, if the row exists at that point of time. The results of the linktest identified by cLLtClientLtIndex can be obtained from the queries to cLLtClientLtResultsTable. ") cLLtClientLinkTestEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1), ).setIndexNames((0, "CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtIndex")) if mibBuilder.loadTexts: cLLtClientLinkTestEntry.setStatus('current') if mibBuilder.loadTexts: cLLtClientLinkTestEntry.setDescription('Each entry in this table represents one instance of the linktest initiated by the user through a network manager. ') cLLtClientLtIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))) if mibBuilder.loadTexts: cLLtClientLtIndex.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtIndex.setDescription('This object uniquely identifies one particular run of the linktest initiated between the client identified by cLLtClientLtMacAddress and the AP it is currently associated with. ') cLLtClientLtMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 2), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cLLtClientLtMacAddress.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtMacAddress.setDescription("This object represents the mac address of the client involved in the particular run of linktest. This object must be set to a valid value when setting cLLtClientRowStatus to 'createAndGo' to initiate a run of linktest. ") cLLtClientLtRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cLLtClientLtRowStatus.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtRowStatus.setDescription('This object is the status column used for creating and deleting instances of the columnar objects in this table. ') cLLtClientLTResultsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2), ) if mibBuilder.loadTexts: cLLtClientLTResultsTable.setStatus('current') if mibBuilder.loadTexts: cLLtClientLTResultsTable.setDescription('This table populates the results of the linktests initiated by the user through the cLLtClientLinkTestTable. This table has a sparse dependent relationship with cLLtClientLinkTestTable. There exists a row in this table corresponding to the row for each row in cLLtClientLinkTestTable identified by cLLtClientLtIndex. A row is added to this table when user, through the network manager, adds a row to cLLtClientLinkTestTable and initiates one run of linktest. A row is deleted by the agent when the corresponding row of cLLtClientLinkTestTable is deleted. The manager is expected to poll cLLtClientLtStatus to check the status of the linktest. Depending on the status read through this object cLLtClientLtStatus, the appropriate columns for CCX or ping tests are read and linktest statistics are gathered. ') cLLtClientLTResultsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1), ).setIndexNames((0, "CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtIndex")) if mibBuilder.loadTexts: cLLtClientLTResultsEntry.setStatus('current') if mibBuilder.loadTexts: cLLtClientLTResultsEntry.setDescription('Each entry in this table represents the results of the linktest identified by cLLtClientLtIndex. ') cLLtClientLtPacketsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 1), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtPacketsSent.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtPacketsSent.setDescription('The number of packets sent to the target client specified by cLLtClientLtMacAddress by the AP it is associated to. ') cLLtClientLtPacketsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 2), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtPacketsRx.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtPacketsRx.setDescription('The number of packets sent by the client specified by cLLtClientLtMacAddress to the AP it is associated to. ') cLLtClientLtTotalPacketsLost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 3), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtTotalPacketsLost.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtTotalPacketsLost.setDescription('The total number of packets lost during the linktest in both the upstream and downstream directions. ') cLLtClientLtApToClientPktsLost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 4), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtApToClientPktsLost.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtApToClientPktsLost.setDescription('The number of packets lost during the linktest in the downstream (direction of traffic from AP to client) direction. ') cLLtClientLtClientToApPktsLost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 5), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtClientToApPktsLost.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtClientToApPktsLost.setDescription('The number of packets lost during the linktest in the upstream (direction of traffic from client to AP) direction. ') cLLtClientLtMinRoundTripTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 6), TimeInterval()).setUnits('hundredths-seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtMinRoundTripTime.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtMinRoundTripTime.setDescription('The minimum round trip time observed on the linktest packet between the AP and the client. ') cLLtClientLtMaxRoundTripTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 7), TimeInterval()).setUnits('hundredths-seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtMaxRoundTripTime.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtMaxRoundTripTime.setDescription('The maximum round trip time observed on the linktest packet between the AP and the client. ') cLLtClientLtAvgRoundTripTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 8), TimeInterval()).setUnits('hundredths-seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtAvgRoundTripTime.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtAvgRoundTripTime.setDescription('The average round trip time observed on the linktest packet between the AP and the client. ') cLLtClientLtUplinkMinRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 9), Integer32()).setUnits('dBm').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtUplinkMinRSSI.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtUplinkMinRSSI.setDescription('The minimum RSSI value as observed at the AP. ') cLLtClientLtUplinkMaxRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 10), Integer32()).setUnits('dBm').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtUplinkMaxRSSI.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtUplinkMaxRSSI.setDescription('The maximum RSSI value as observed at the AP. ') cLLtClientLtUplinkAvgRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 11), Integer32()).setUnits('dBm').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtUplinkAvgRSSI.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtUplinkAvgRSSI.setDescription('The average RSSI value as observed at the AP. ') cLLtClientLtDownlinkMinRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 12), Integer32()).setUnits('dBm').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtDownlinkMinRSSI.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDownlinkMinRSSI.setDescription('The minimum RSSI value as observed at the client. ') cLLtClientLtDownlinkMaxRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 13), Integer32()).setUnits('dBm').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtDownlinkMaxRSSI.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDownlinkMaxRSSI.setDescription('The maximum RSSI value as observed at the client. ') cLLtClientLtDownlinkAvgRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 14), Integer32()).setUnits('dBm').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtDownlinkAvgRSSI.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDownlinkAvgRSSI.setDescription('The average RSSI value as observed at the client. ') cLLtClientLtUplinkMinSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 15), Integer32()).setUnits('dB').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtUplinkMinSNR.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtUplinkMinSNR.setDescription('The minimum SNR value as observed at the AP. ') cLLtClientLtUplinkMaxSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 16), Integer32()).setUnits('dB').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtUplinkMaxSNR.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtUplinkMaxSNR.setDescription('The maximum SNR value as observed at the AP. ') cLLtClientLtUplinkAvgSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 17), Integer32()).setUnits('dB').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtUplinkAvgSNR.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtUplinkAvgSNR.setDescription('The average SNR value as observed at the AP. ') cLLtClientLtDownlinkMinSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 18), Integer32()).setUnits('dB').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtDownlinkMinSNR.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDownlinkMinSNR.setDescription('The minimum SNR value as observed at the client. ') cLLtClientLtDownlinkMaxSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 19), Integer32()).setUnits('dB').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtDownlinkMaxSNR.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDownlinkMaxSNR.setDescription('The maximum SNR value as observed at the client. ') cLLtClientLtDownlinkAvgSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 20), Integer32()).setUnits('dB').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtDownlinkAvgSNR.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDownlinkAvgSNR.setDescription('The average SNR value as observed at the client. ') cLLtClientLtTotalTxRetriesAP = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 21), Counter32()).setUnits('retries').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtTotalTxRetriesAP.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtTotalTxRetriesAP.setDescription('The total number of linktest packet transmission retries as observed at the AP. ') cLLtClientLtMaxTxRetriesAP = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 22), Counter32()).setUnits('retries').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtMaxTxRetriesAP.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtMaxTxRetriesAP.setDescription('The maximum number of linktest packet transmission retries observed at the AP. ') cLLtClientLtTotalTxRetriesClient = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 23), Counter32()).setUnits('retries').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtTotalTxRetriesClient.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtTotalTxRetriesClient.setDescription('The total number of linktest packet transmission retries at the client. ') cLLtClientLtMaxTxRetriesClient = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 24), Counter32()).setUnits('retries').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtMaxTxRetriesClient.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtMaxTxRetriesClient.setDescription('The maximum number of linktest packet transmission retries observed at the client. ') cLLtClientLtStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("cLLtClientLtStatusFailed", 0), ("cLLtClientLtStatusCcxInProgress", 1), ("cLLtClientLtStatusPngInProgress", 2), ("cLLtClientLtStatusPingSuccess", 3), ("cLLtClientLtStatusCcxLtSuccess", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtStatus.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtStatus.setDescription("This object indicates the status of the linktest this particular entry corresponds to. The semantics as follows. 'cLLtClientLtStatusFailed' - This value indicates that this particular linktest has failed. 'cLLtClientLtCcxStatusInProgress' - This value indicates that the CCX linktest is in progress. 'cLLtClientLtPngStatusInProgress' - This value indicates that the Ping-based linktest is in progress. 'cLLtClientLtStatusPingSuccess' - This value indicates that ping-based linktest between AP and client has succeeded. Only the following columns of this table should be considered for collecting data from the ping responses. cLLtClientLtPacketsSent, cLLtClientLtPacketsRx, cLLtClientLtUplinkAvgRSSI, cLLtClientLtUplinkAvgSNR cLLtClientLtStatusCcxLtSuccess - This value indicates that CCX linktest done to test the link between the client and the AP is successful. All the columns of this table are applicable and valid for collecting data from the CCX responses. ") cLLtClientLtDataRateTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1), ) if mibBuilder.loadTexts: cLLtClientLtDataRateTable.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDataRateTable.setDescription('This table provides the results of CCX Link tests classified on different data rates between AP and clients. A row is added to this table automatically by the agent corresponding to one linktest identified by cLLtClientLtIndex and deleted when the corresponding row in cLLtClientLinkTestTable is deleted. ') cLLtClientLtDataRateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtIndex"), (0, "CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDataRate")) if mibBuilder.loadTexts: cLLtClientLtDataRateEntry.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDataRateEntry.setDescription('Each entry represents a conceptual row and populates the number of packets sent in the linktest identified by cLLtClientLtIndex. The statistics of the linktest are classified based on the respective data rates identified by cLLtClientLtDataRate. ') cLLtClientLtDataRate = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 255))) if mibBuilder.loadTexts: cLLtClientLtDataRate.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtDataRate.setDescription('This object identifies the rate at which packets are transmitted. The rates are defined in Mbps with the following being the possible values. Rates - 1,2,5.5,6,9,11,12,18,24,36,48,54,108. ') cLLtClientLtRateDownlinkPktsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 2), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtRateDownlinkPktsSent.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtRateDownlinkPktsSent.setDescription('The number of packets sent by the AP at the rate identified by cLLtClientLtDataRate. ') cLLtClientLtRateUplinkPktsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 3), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cLLtClientLtRateUplinkPktsSent.setStatus('current') if mibBuilder.loadTexts: cLLtClientLtRateUplinkPktsSent.setDescription('The number of packets sent by the client at the rate identified by cLLtClientLtDataRate. ') ciscoLwappLinkTestMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 1)) ciscoLwappLinkTestMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2)) ciscoLwappLinkTestMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 1, 1)).setObjects(("CISCO-LWAPP-LINKTEST-MIB", "cLLinkTestConfigGroup"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLinkTestRunsGroup"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLinkTestStatusGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoLwappLinkTestMIBCompliance = ciscoLwappLinkTestMIBCompliance.setStatus('current') if mibBuilder.loadTexts: ciscoLwappLinkTestMIBCompliance.setDescription('The compliance statement for the SNMP entities that implement the ciscoLwappLinkTestMIB module.') cLLinkTestConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 1)).setObjects(("CISCO-LWAPP-LINKTEST-MIB", "cLLtResponder"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtPacketSize"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtNumberOfPackets"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtTestPurgeTime")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cLLinkTestConfigGroup = cLLinkTestConfigGroup.setStatus('current') if mibBuilder.loadTexts: cLLinkTestConfigGroup.setDescription('This collection of objects represent the linktest parameters for use during the various of the tests. ') cLLinkTestRunsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 2)).setObjects(("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMacAddress"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtPacketsSent"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtPacketsRx"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtTotalPacketsLost"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtApToClientPktsLost"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtClientToApPktsLost"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMinRoundTripTime"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMaxRoundTripTime"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtAvgRoundTripTime"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkMinRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkMaxRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkAvgRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkMinRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkMaxRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkAvgRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkMinSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkMaxSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkAvgSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkMinSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkMaxSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkAvgSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtTotalTxRetriesAP"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMaxTxRetriesAP"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtTotalTxRetriesClient"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMaxTxRetriesClient"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtStatus"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cLLinkTestRunsGroup = cLLinkTestRunsGroup.setStatus('current') if mibBuilder.loadTexts: cLLinkTestRunsGroup.setDescription('This collection of objects is used to initiate linktests and retrieve the results of the respective runs of the tests. ') cLLinkTestStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 3)).setObjects(("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtRateDownlinkPktsSent"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtRateUplinkPktsSent")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cLLinkTestStatusGroup = cLLinkTestStatusGroup.setStatus('current') if mibBuilder.loadTexts: cLLinkTestStatusGroup.setDescription('This collection of objects provide information about the linktest results. ') mibBuilder.exportSymbols("CISCO-LWAPP-LINKTEST-MIB", ciscoLwappLinkTestMIBCompliances=ciscoLwappLinkTestMIBCompliances, cLLtClientLtTotalTxRetriesClient=cLLtClientLtTotalTxRetriesClient, cLLtClientLtUplinkMinSNR=cLLtClientLtUplinkMinSNR, cLLtClientLinkTestTable=cLLtClientLinkTestTable, cLLtClientLtRateUplinkPktsSent=cLLtClientLtRateUplinkPktsSent, cLLtClientLTResultsTable=cLLtClientLTResultsTable, PYSNMP_MODULE_ID=ciscoLwappLinkTestMIB, cLLtResponder=cLLtResponder, cLLtClientLTResultsEntry=cLLtClientLTResultsEntry, cLLtClientLtUplinkAvgRSSI=cLLtClientLtUplinkAvgRSSI, cLLtClientLtUplinkMaxSNR=cLLtClientLtUplinkMaxSNR, cLLtNumberOfPackets=cLLtNumberOfPackets, cLLtClientLtUplinkAvgSNR=cLLtClientLtUplinkAvgSNR, cLLtClientLtDataRateTable=cLLtClientLtDataRateTable, ciscoLwappLinkTestRun=ciscoLwappLinkTestRun, cLLtClientLtUplinkMinRSSI=cLLtClientLtUplinkMinRSSI, cLLtClientLtPacketsRx=cLLtClientLtPacketsRx, cLLtClientLtDownlinkAvgSNR=cLLtClientLtDownlinkAvgSNR, cLLtClientLtClientToApPktsLost=cLLtClientLtClientToApPktsLost, cLLtClientLtDataRateEntry=cLLtClientLtDataRateEntry, cLLtClientLtRateDownlinkPktsSent=cLLtClientLtRateDownlinkPktsSent, cLLtClientLtMacAddress=cLLtClientLtMacAddress, cLLtClientLtMaxRoundTripTime=cLLtClientLtMaxRoundTripTime, cLLtClientLtMinRoundTripTime=cLLtClientLtMinRoundTripTime, cLLtClientLtPacketsSent=cLLtClientLtPacketsSent, cLLtClientLtAvgRoundTripTime=cLLtClientLtAvgRoundTripTime, cLLtClientLtDownlinkAvgRSSI=cLLtClientLtDownlinkAvgRSSI, cLLtClientLtMaxTxRetriesClient=cLLtClientLtMaxTxRetriesClient, cLLtClientLtDataRate=cLLtClientLtDataRate, cLLtClientLtApToClientPktsLost=cLLtClientLtApToClientPktsLost, cLLtPacketSize=cLLtPacketSize, cLLtClientLtDownlinkMinRSSI=cLLtClientLtDownlinkMinRSSI, ciscoLwappLinkTestStatus=ciscoLwappLinkTestStatus, cLLtClientLtDownlinkMaxRSSI=cLLtClientLtDownlinkMaxRSSI, cLLtClientLtIndex=cLLtClientLtIndex, cLLtClientLtDownlinkMinSNR=cLLtClientLtDownlinkMinSNR, cLLinkTestRunsGroup=cLLinkTestRunsGroup, ciscoLwappLinkTestMIBNotifs=ciscoLwappLinkTestMIBNotifs, ciscoLwappLinkTestConfig=ciscoLwappLinkTestConfig, cLLtClientLtUplinkMaxRSSI=cLLtClientLtUplinkMaxRSSI, ciscoLwappLinkTestMIBCompliance=ciscoLwappLinkTestMIBCompliance, cLLtClientLinkTestEntry=cLLtClientLinkTestEntry, ciscoLwappLinkTestMIBObjects=ciscoLwappLinkTestMIBObjects, cLLtTestPurgeTime=cLLtTestPurgeTime, cLLtClientLtRowStatus=cLLtClientLtRowStatus, cLLtClientLtDownlinkMaxSNR=cLLtClientLtDownlinkMaxSNR, cLLtClientLtMaxTxRetriesAP=cLLtClientLtMaxTxRetriesAP, cLLinkTestStatusGroup=cLLinkTestStatusGroup, ciscoLwappLinkTestMIB=ciscoLwappLinkTestMIB, cLLinkTestConfigGroup=cLLinkTestConfigGroup, cLLtClientLtTotalPacketsLost=cLLtClientLtTotalPacketsLost, ciscoLwappLinkTestMIBGroups=ciscoLwappLinkTestMIBGroups, cLLtClientLtTotalTxRetriesAP=cLLtClientLtTotalTxRetriesAP, cLLtClientLtStatus=cLLtClientLtStatus, ciscoLwappLinkTestMIBConform=ciscoLwappLinkTestMIBConform)
'''Play on numbers with arthitemetic''' def simple_math_calc(): """Do simple mathematical calculation""" num_value1 = 10 num_value2 = 20 num_pi = 22/7 print(num_pi) print('{0} + {1} = {2}'.format(num_value1, num_value2, num_value1+num_value2)) input1 = input("Enter first number for addition? ") input2 = input("Enter second number for addition? ") print(f'String number addition {input1}, {input2}, {input1+input2}') print(f'number addition {input1} + {input2} = {float(input1)+float(input2)}') return input1, input2, num_pi, num_value1, num_value2 def is_prime(number_to_test): """Find whether the given number is primte""" for index in range(2, number_to_test-1, 1): if number_to_test%index == 0: return False return True if __name__ == "__main__": for NUM in [3, 5, 7, 20, 17, 51, 98, 45, 67, 37, 62]: print("Given number {0} - Is Prime? {1}".format(NUM, is_prime(NUM))) #simple_math_calc()
""" This folder is modified from https://github.com/sungyubkim/MINE-Mutual-Information-Neural-Estimation- from mutual information estimation """
#!python def linear_search(array, item): """return the first index of item in array or None if item is not found""" # implement linear_search_iterative and linear_search_recursive below, then # change this to call your implementation to verify it passes all tests return linear_search_iterative(array, item) # return linear_search_recursive(array, item) def linear_search_iterative(array, item): # loop over all array values until item is found for index, value in enumerate(array): if item == value: return index # found return None # not found def linear_search_recursive(array, item, index=0): # TODO: implement linear search recursively here # once implemented, change linear_search to call linear_search_recursive # to verify that your recursive implementation passes all tests if array[index] == item: return index elif index < len(array) - 1: return linear_search_recursive(array, item, index + 1) else: return None def binary_search(array, item): """return the index of item in sorted array or None if item is not found""" # implement binary_search_iterative and binary_search_recursive below, then # change this to call your implementation to verify it passes all tests return binary_search_iterative(array, item) # return binary_search_recursive(array, item) def binary_search_iterative(array, item): # TODO: implement binary search iteratively here # once implemented, change binary_search to call binary_search_iterative # to verify that your iterative implementation passes all tests index = len(array) // 2 left, right = None, None while array[index] != item: if left and right: index = (right + left) // 2 elif left: index = (len(array) + left) // 2 elif right: index = right // 2 elif not (left or right): index = len(array) // 2 if index == left or index == right: return None elif item < array[index]: right = index elif item > array[index]: left = index return index #The time complexity for this function would be O(log n) as any algorithm which multiplies by 1/2. # The best case would be O(1) def binary_search_recursive(array, item, left=None, right=None): # TODO: implement binary search recursively here # once implemented, change binary_search to call binary_search_recursive # to verify that your recursive implementation passes all tests if left and right: index = (right + left) // 2 elif left: index = (len(array) + left) // 2 elif right: index = right // 2 elif not (left or right): index = len(array) // 2 if index == left or index == right: return None if array[index] == item: return index elif item < array[index]: return binary_search_recursive(array, item, left=left, right =index) elif item > array[index]: return binary_search_recursive(array, item, left = index, right=right) #The time complexity for this would be O(log n). #The best case complexity would be O(1).
class BaseTestFunction(object): r"""Base class for all test functions in optimization. For more details, please refer to `this Wikipedia page`_. .. _this Wikipedia page: https://en.wikipedia.org/wiki/Test_functions_for_optimization The subclass should implement at least the following: - :meth:`__call__` """ def __call__(self, x): raise NotImplementedError
# Test that returning of NotImplemented from binary op methods leads to # TypeError. try: NotImplemented except NameError: print("SKIP") raise SystemExit class C: def __init__(self, value): self.value = value def __str__(self): return "C({})".format(self.value) def __add__(self, rhs): print(self, '+', rhs) return NotImplemented def __sub__(self, rhs): print(self, '-', rhs) return NotImplemented def __lt__(self, rhs): print(self, '<', rhs) return NotImplemented def __neg__(self): print('-', self) return NotImplemented c = C(0) try: c + 1 except TypeError: print("TypeError") try: c - 2 except TypeError: print("TypeError") try: c < 1 except TypeError: print("TypeError") # NotImplemented isn't handled specially in unary methods print(-c) # Test that NotImplemented can be hashed print(type(hash(NotImplemented)))
# -*- coding: utf-8 -*- """Track earth satellite TLE orbits using up-to-date 2010 version of SGP4 This Python package computes the position and velocity of an earth-orbiting satellite, given the satellite's TLE orbital elements from a source like `Celestrak <http://celestrak.com/>`_. It implements the most recent version of SGP4, and is regularly run against the SGP4 test suite to make sure that its satellite position predictions **agree to within 0.1 mm** of the predictions of the standard C++ implementation of the algorithm. This error is far less than the 1–3 km/day by which satellites themselves deviate from the ideal orbits described in TLE files. Note that these official SGP4 routines do not implement all the steps necessary to convert satellite positions into geographic coordinates; they need to be integrated into a more comprehensive astronomy library. One example is the Python `Skyfield <http://rhodesmill.org/skyfield/>`_ package, which uses this SGP4 library when you ask it to turn satellite elements into Earth positions as described in its documentation: http://rhodesmill.org/skyfield/earth-satellites.html These SGP4 routines, by contrast, produce only raw spatial coordinates. To run the test suite for this module, clone its repository from GitHub: https://github.com/brandon-rhodes/python-sgp4 Then invoke the tests using the Python Standard Library:: python -m unittest discover sgp4 The C++ function names have been retained, since users may already be familiar with this library in other languages. Here is how to compute the x,y,z position and velocity for Vanguard 1 at 12:50:19 on 29 June 2000: >>> from earth_gravity import wgs72 >>> from sgp4io import twoline2rv >>> >>> line1 = ('1 00005U 58002B 00179.78495062 ' ... '.00000023 00000-0 28098-4 0 4753') >>> line2 = ('2 00005 34.2682 348.7242 1859667 ' ... '331.7664 19.3264 10.82419157413667') >>> >>> satellite = twoline2rv(line1, line2, wgs72) >>> position, velocity = satellite.propagate( ... 2000, 6, 29, 12, 50, 19) >>> >>> print(satellite.error) # nonzero on error 0 >>> print(satellite.error_message) None >>> print(position) (5576.056952..., -3999.371134..., -1521.957159...) >>> print(velocity) (4.772627..., 5.119817..., 4.275553...) The position vector measures the satellite position in **kilometers** from the center of the earth. The velocity is the rate at which those three parameters are changing, expressed in **kilometers per second**. There are three gravity models available that you can import from the ``earth_gravity`` module: * ``wgs72`` * ``wgs72old`` * ``wgs84`` The ``wgs72`` model seems to be the most commonly used in the satellite tracking community, and is probably the model behind most TLE elements that are available for download. The ``twoline2rv()`` function returns a ``Satellite`` object whose attributes carry the data loaded from the TLE entry: * Unique satellite number, as given in the TLE file. >>> satellite.satnum 5 * The epoch of the element set, expressed three ways: as the integer year plus the floating point number of days into the year; as a floating-point Julian date; and as Python ``datetime`` object. >>> satellite.epochyr 2000 >>> satellite.epochdays 179.78495062 >>> satellite.jdsatepoch 2451723.28495062 >>> satellite.epoch datetime.datetime(2000, 6, 27, 18, 50, 19, 733567) This implementation passes all of the automated tests in the August 2010 release of the reference implementation of SGP4 by Vallado et al., who originally published their revision of SGP4 in 2006: Vallado, David A., Paul Crawford, Richard Hujsak, and T.S. Kelso, “Revisiting Spacetrack Report #3,” presented at the AIAA/AAS Astrodynamics Specialist Conference, Keystone, CO, 2006 August 21–24. If you would like to review the paper, it is `available online <http://www.celestrak.com/publications/AIAA/2006-6753/>`_. You can always download the latest version of their code for comparison against this Python module (or other implementations) at `AIAA-2006-6753.zip <http://www.celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753.zip>`_. This module was adapted from Vallado's C++ code since its revision date was the most recently updated SGP4 implementation in their zip file: * C++, August 2010 * Fortran, August 2008 * Pascal, August 2008 * Matlab, May 2008 * Java, July 2005 Changelog --------- | 2019-08-?? — 1.5 — Make ``gstime()`` a public function; clarify format error message. | 2015-01-15 — 1.4 — Display detailed help when TLE input does not match format. | 2014-06-26 — 1.3 — Return ``(NaN,NaN,NaN)`` vectors on error and set ``.error_message`` | 2013-11-29 — 1.2 — Made ``epochyr`` 4 digits; add ``datetime`` for ``.epoch`` | 2012-11-22 — 1.1 — Python 3 compatibility; more documentation | 2012-08-27 — 1.0 — Initial release """
# POWER OF THREE LEETCODE SOLUTION: # creating a class. class Solution(object): # creating a function to solve the problem. def isPowerOfThree(self, n): # creating a variable to track the exponent. i = 0 # creating a while-loop to iterate until the desired number. while 3 ** i <= n: # creating a nested if-statement to check if the desired number is met. if 3 ** i == n: # returning true if the condition is met. return True # code to increment the exponent by one after each iteration. i += 1 # returning False if the condition is not met. return False
if False: print("Really, really false.") elif False: print("nested") else: if "seems rediculous": print("it is.")
nome = str(input('Qual e o seu nome?')) if nome =='Gustavo': print('Que nome lindo voce tem!') else: print('Seu nome e tao normal!') print('Bom dia {}!'.format(nome))
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ def decode_imsi(imsi64): """ Convert from the compacted uint back to a string, using the second two bits to determine the padding Args: imsi64 - compacted representation of imsi with padding at end Returns: imsi string in the form IMSI00101... """ prefix_len = (imsi64 >> 1) & 0x3 return 'IMSI' + '0' * prefix_len + str(imsi64 >> 3) def encode_imsi(imsi): """ Convert a IMSI string to a uint + length. IMSI strings can contain two prefix zeros for test MCC and maximum fifteen digits. Bit 1 of the compacted uint is always 1, so that we can match on it set. Bits 2-3 the compacted uint contain how many leading 0's are in the IMSI. For example, if the IMSI is 001010000000013, the first bit is 0b1, the second two bits would be 0b10 and the remaining bits would be 1010000000013 << 3 Args: imsi - string representation of imsi Returns: int representation of imsi with padding amount at end """ if imsi.startswith('IMSI'): imsi = imsi[4:] # strip IMSI off of string prefix_len = len(imsi) - len(imsi.lstrip('0')) compacted = (int(imsi) << 2) | (prefix_len & 0x3) return compacted << 1 | 0x1
class Solution: def findRestaurant(self, list1, list2): """ :type list1: List[str] :type list2: List[str] :rtype: List[str] """ inverse1 = {e: i for i, e in enumerate(list1)} overlap = collections.defaultdict(list) # stored by index sum for j, e in enumerate(list2): try: overlap[inverse1[e] + j].append(e) except KeyError: pass return overlap[min(overlap)]
class DescriptorTypesEnum(): _ECFP = "ecfp" _ECFP_COUNTS = "ecfp_counts" _MACCS_KEYS = "maccs_keys" _AVALON = "avalon" @property def ECFP(self): return self._ECFP @ECFP.setter def ECFP(self, value): raise ValueError("Do not assign value to a DescriptorTypesEnum field") @property def ECFP_COUNTS(self): return self._ECFP_COUNTS @ECFP_COUNTS.setter def ECFP_COUNTS(self, value): raise ValueError("Do not assign value to a DescriptorTypesEnum field") @property def MACCS_KEYS(self): return self._MACCS_KEYS @MACCS_KEYS.setter def MACCS_KEYS(self, value): raise ValueError("Do not assign value to a DescriptorTypesEnum field") @property def AVALON(self): return self._AVALON @AVALON.setter def AVALON(self, value): raise ValueError("Do not assign value to a DescriptorTypesEnum field")
# 23 - Faça um programa que leia um número de 0 a 9999 # e mostre na tela cada um dos dígitos separados. num = int(input('Digite um numero: ')) u = num // 1 % 10 d = num // 10 % 10 c = num // 100 % 10 m = num // 1000 % 10 print('Analisando o número {}'.format(num)) print('Milhar: {}, centena: {}, dezena: {}, unidade: {}'.format(m, c, d, u))
day_events_list = input().split("|") MAX_ENERGY = 100 ORDER_ENERGY = 30 REST_ENERGY = 50 energy = 100 coins = 100 is_not_bankrupt = True for event in day_events_list: single_events_list = event.split("-") name = single_events_list[0] value = int(single_events_list[1]) if name == "rest": gained_energy = 0 if energy + value > MAX_ENERGY: gained_energy = MAX_ENERGY - energy energy = MAX_ENERGY else: energy += value gained_energy = value print(f"You gained {gained_energy} energy.") print(f"Current energy: {energy}.") elif name == "order": if energy >= ORDER_ENERGY: energy -= ORDER_ENERGY coins += value print(f"You earned {value} coins.") else: energy += REST_ENERGY print("You had to rest!") continue else: if coins > value: coins -= value print(f"You bought {name}.") else: print(f"Closed! Cannot afford {name}.") is_not_bankrupt = False break if is_not_bankrupt: print("Day completed!") print(f"Coins: {coins}") print(f"Energy: {energy}")
class WebpreviewException(Exception): """ Base Webpreview Exception. """ pass class EmptyURL(WebpreviewException): """ WebpreviewException for empty URL. """ pass class EmptyProperties(WebpreviewException): """ WebpreviewException for empty properties. """ pass class URLNotFound(WebpreviewException): """ WebpreviewException for 404 URLs. """ pass class URLUnreachable(WebpreviewException): """ WebpreviewException for 404 URLs. """ pass
def main(j, args, params, tags, tasklet): params.merge(args) doc = params.doc # tags = params.tags actor=j.apps.actorsloader.getActor("system","gridmanager") organization = args.getTag("organization") name = args.getTag("jsname") out = '' missing = False for k,v in {'organization':organization, 'name':name}.items(): if not v: out += 'Missing param %s.\n' % k missing = True if not missing: obj = actor.getJumpscript(organization=organization, name=name) out = ['||Property||Value||'] for k,v in obj.items(): if k in ('args', 'roles'): v = ' ,'.join(v) if k == 'source': continue v = j.data.text.toStr(v) out.append("|%s|%s|" % (k.capitalize(), v.replace('\n', '') if v else v)) out.append('\n{{code:\n%s\n}}' % obj['source']) out = '\n'.join(out) doc.applyTemplate({'name': name}) params.result = (out, doc) return params def match(j, args, params, tags, tasklet): return True
class color: black = "\033[30m" red = "\033[31m" green = "\033[32m" yellow = "\033[33m" blue = "\033[34m" magenta = "\033[35m" cyan = "\033[36m" white = "\033[37m" class bright: black_1 = "\033[1;30m" red_1 = "\033[1;31m" green_1 = "\033[1;32m" yellow_1 = "\033[1;33m" blue_1 = "\033[1;34m" magenta_1 = "\033[1;35m" cyan_1 = "\033[1;36m" white_1 = "\033[1;37m"
# -*- coding: utf-8 -*- """ dicts contains a number of special-case dictionaries. .. testsetup:: * import kutils.dicts as kd """ class AttrDict(dict): """ AttrDict represents a dictionary where the keys are represented as attributes. >>> d = kd.AttrDict(foo='bar') >>> d.foo 'bar' >>> d['foo'] 'bar' """ def __init__(self, *args, **kwargs): super(AttrDict, self).__init__(*args, **kwargs) self.__dict__ = self class NoneDict(dict): """ NoneDict is a dictionary that returns ``None`` if a key is unavailable. >>> d = kd.NoneDict(foo='bar') >>> d['foo'] 'bar' >>> d['baz'] is None True """ def __init__(self, *args, **kwargs): super(NoneDict, self).__init__(*args, **kwargs) def __getitem__(self, item): return self.get(item, None) class StrDict(dict): """ StrDict is a dictionary that returns an empty string if a key is unavailable. >>> d = kd.StrDict(foo='bar') >>> d['foo'] 'bar' >>> d['baz'] '' """ def __init__(self, *args, **kwargs): super(StrDict, self).__init__(*args, **kwargs) def __getitem__(self, item): return self.get(item, str()) class DictDict(dict): """ DictDict is a dictionary that returns an empty StrDict if a key is unavailable. This is meant for a dictionary of dictionaries of string values. >>> d = kd.DictDict() >>> d['foo'] {} >>> type(d['foo']) <class 'kutils.dicts.StrDict'> """ def __init__(self, *args, **kwargs): super(DictDict, self).__init__(*args, **kwargs) def __getitem__(self, item): return self.get(item, StrDict()) class AttrNoneDict(AttrDict, NoneDict): """ AttrNoneDict returns an AttrDict that returns None if a key isn't present. >>> d = kd.AttrNoneDict(foo='bar') >>> d.foo 'bar' >>> d['foo'] 'bar' >>> d.bar is None True >>> d['bar'] is None True """ def __init__(self, *args, **kwargs): super(AttrNoneDict, self).__init__(*args, **kwargs) def __getattr__(self, item): if item in self: return self[item] return None class AttrStrDict(AttrDict, StrDict): """ AttrStrDict returns an AttrDict that returns an empty string if a key isn't present. >>> d = kd.AttrStrDict(foo='bar') >>> d.foo 'bar' >>> d['foo'] 'bar' >>> d.bar '' >>> d['bar'] '' """ def __init__(self, *args, **kwargs): super(AttrStrDict, self).__init__(*args, **kwargs) def __getattr__(self, item): if item in self: return self[item] return str() class DictDict(dict): """ DictDict is a dictionary that returns an empty AttrStrDict if a key is unavailable. This is meant for a dictionary of dictionaries of string values. >>> d = kd.DictDict() >>> d['foo'] {} >>> type(d['foo']) <class 'kutils.dicts.AttrStrDict'> >>> d.foo.bar '' """ def __init__(self, *args, **kwargs): super(DictDict, self).__init__(*args, **kwargs) def __getitem__(self, item): return self.get(item, AttrStrDict()) def __getattr__(self, item): if item in self: return self[item] return AttrStrDict() class AttrDictDict(AttrDict, DictDict): """ AttrDictDict is a dictionary that returns an empty StrDict if a key is unavailable. This is meant for a dictionary of dictionaries of string values. >>> d = kd.AttrDictDict() >>> d.foo {} >>> d['foo'] {} >>> d.foo.bar '' >>> d['foo']['bar'] '' """ def __init__(self, *args, **kwargs): super(AttrDictDict, self).__init__(*args, **kwargs) def __getattr__(self, item): if item in self: return self[item] return AttrStrDict()
class Hotel: def __init__(self, name, roomType, price) -> None: super().__init__() self._name: str = name self._roomType: str = roomType self._price: float = float(price) def __str__(self) -> str: return "酒店:{} {} {:.2f}RMB/晚".format(self._name, self._roomType, self._price)
##This does nothing yet... class Broker(object): def __init__(self): self.name = 'ETrade' self.tradeFee = 4.95
def direct_path(string): """ Given a Linux Path "/users/john/documents/../desktop/./../" return the direct equivalent path "/users/john/" O(n) time O(n) space """ pile = [] for directory in string.split('/'): if directory: if directory == '.': pass else: if directory == '..': pile.pop() else: pile.append(directory) return '/' + '/'.join(pile) + '/'
class Neuron(object): def __init__(self, *args, **kwargs): super(Neuron, self).__init__()
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # NOTE: This class is auto generated by the jdcloud code generator program. class FilterCfg(object): def __init__(self, id=None, partOfReq=None, reqKey=None, matchLogic=None, reqValue=None, decodeFunc=None, isBase64Decode=None): """ :param id: (Optional) 序号,不作更新使用 :param partOfReq: (Optional) 请求位置 当匹配类型为"str"/"regex"/"size"时,可选字段:["headers"/"cookie"/"args"/"body"/"uri"/"method"] | 匹配类型为"SQLi"/"XSS"时:可选字段:["headers"/"cookie"/"args"/"body"/"uri"]|当匹配类型为"geo"/"ip"时,该字段为空 :param reqKey: (Optional) 指定key,匹配类型为"geo"/"ip"时,该字段为空,| partOfReq为uri/body/method 时,该字段为空,header/cookie时非空,args时选填 :param matchLogic: (Optional) 匹配类型"str"时:["startsWith"/"endsWith"/"contains"/"equal"]|匹配类型为"geo"/"SQLi"/"XSS"/"regex"时:""|匹配类型为"size"时:["equal"/"notEquals"/"greaterThan"/"greaterThanOrEqual"/"lessThan"/"lessThanOrEqual"] :param reqValue: (Optional) // 匹配类型为"SQLi"/"XSS"时:"",匹配类型为"geo"时:该值为省份名称。匹配类型为"ip"时,该值为 ipv4/8/16/24/32)/ipv6/64 ipv6/128)| 匹配类型为"size"时:数字字符串 其他类型不限 :param decodeFunc: (Optional) 仅type为str regex SQLi XSS时可非空,取值"","lowercase","trim","base64Decode","urlDecode","htmlDecode","hexDecode","sqlTrim"按先后顺序,多个时用 , 分隔 :param isBase64Decode: (Optional) 不解码"base64Decode"解码,str时才有 """ self.id = id self.partOfReq = partOfReq self.reqKey = reqKey self.matchLogic = matchLogic self.reqValue = reqValue self.decodeFunc = decodeFunc self.isBase64Decode = isBase64Decode
num = int(input('Digite uma numero:')) b = bin(num) o = oct(num) h = hex(num) print('''Escolha [1] binario [2] octal [3] hex ''') opcao = int(input('sua Opcao: ')) if opcao == 1: print('{} convertido {}'.format(num,b[2:])) elif opcao == 2: print('{} convertido {}'.format(num,o[2:])) elif opcao == 3: print('{} convertido {}'.format(num,h[2:]))
''' Created on 2015年8月2日 @author: sunshyran ''' class AbstractClient(object): def __init__(self, invoker_handler): self.handler = invoker_handler self.handler.startup() def stop(self): self.handler.shutdown() def request(self, invoker, timeout=5000): ''' \ 同步阻塞调用,返回Response ''' invoker = self.handler.invoke(invoker) invoker.wait(timeout) return invoker.result def asyncrequest(self, invoker): ''' \ 异步非阻塞调用,返回None。结果处理由responseListener负责 ''' self.handler.invoke(invoker) return None
############################################################################ # # Copyright (C) 2016 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. # # Commercial License Usage # Licensees holding valid commercial Qt licenses may use this file in # accordance with the commercial license agreement provided with the # Software or, alternatively, in accordance with the terms contained in # a written agreement between you and The Qt Company. For licensing terms # and conditions see https://www.qt.io/terms-conditions. For further # information use the contact form at https://www.qt.io/contact-us. # # GNU General Public License Usage # Alternatively, this file may be used under the terms of the GNU # General Public License version 3 as published by the Free Software # Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT # included in the packaging of this file. Please review the following # information to ensure the GNU General Public License requirements will # be met: https://www.gnu.org/licenses/gpl-3.0.html. # ############################################################################ source("../../shared/qtcreator.py") qmlEditor = ":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget" outline = ":Qt Creator_QmlJSEditor::Internal::QmlJSOutlineTreeView" treebase = "keyinteraction.Resources.keyinteraction\\.qrc./keyinteraction.focus." def main(): sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_6_1_DEFAULT), "quick", "keyinteraction") proFile = "keyinteraction.pro" if not neededFilePresent(os.path.join(sourceExample, proFile)): return templateDir = prepareTemplate(sourceExample) startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return openQmakeProject(os.path.join(templateDir, proFile), [Targets.DESKTOP_5_6_1_DEFAULT]) qmlFiles = [treebase + "focus\\.qml", treebase + "Core.ListMenu\\.qml"] checkOutlineFor(qmlFiles) testModify() invokeMenuItem("File", "Save All") invokeMenuItem("File", "Exit") def checkOutlineFor(qmlFiles): for qmlFile in qmlFiles: if not openDocument(qmlFile): test.fatal("Failed to open file '%s'" % simpleFileName(qmlFile)) continue selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Outline") pseudoTree = buildTreeFromOutline() # __writeOutlineFile__(pseudoTree, simpleFileName(qmlFile)+"_outline.tsv") verifyOutline(pseudoTree, simpleFileName(qmlFile) + "_outline.tsv") def buildTreeFromOutline(): global outline model = waitForObject(outline).model() waitFor("model.rowCount() > 0") snooze(1) # if model updates delayed processChildren() results in AUT crash return processChildren(model, QModelIndex(), 0) def processChildren(model, startIndex, level): children = [] for index in dumpIndices(model, startIndex): annotationData = str(index.data(Qt.UserRole + 3)) # HACK - taken from source children.append((str(index.data()), level, annotationData)) if model.hasChildren(index): children.extend(processChildren(model, index, level + 1)) return children def testModify(): global qmlEditor if not openDocument(treebase + "focus\\.qml"): test.fatal("Failed to open file focus.qml") return test.log("Testing whether modifications show up inside outline.") if not placeCursorToLine(qmlEditor, 'color: "#3E606F"'): return test.log("Modification: adding a QML element") typeLines(qmlEditor, ['', '', 'Text {', 'id: addedText', 'text: "Squish QML outline test"', 'color: "darkcyan"', 'font.bold: true', 'anchors.centerIn: parent']) selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Outline") snooze(1) # no way to wait for a private signal pseudoTree = buildTreeFromOutline() # __writeOutlineFile__(pseudoTree, "focus.qml_mod1_outline.tsv") verifyOutline(pseudoTree, "focus.qml_mod1_outline.tsv") test.log("Modification: change existing content") performModification('color: "#3E606F"', "<Left>", 7, "Left", "white") performModification('color: "black"', "<Left>", 5, "Left", "#cc00bb") performModification('rotation: 90', None, 2, "Left", "180") snooze(1) # no way to wait for a private signal pseudoTree = buildTreeFromOutline() # __writeOutlineFile__(pseudoTree, "focus.qml_mod2_outline.tsv") verifyOutline(pseudoTree, "focus.qml_mod2_outline.tsv") test.log("Modification: add special elements") placeCursorToLine(qmlEditor, 'id: window') typeLines(qmlEditor, ['', '', 'property string txtCnt: "Property"', 'signal clicked', '', 'function clicked() {','console.log("click")']) performModification('onClicked: contextMenu.focus = true', None, 24, "Left", '{') performModification('onClicked: {contextMenu.focus = true}', "<Left>", 0, None, ';window.clicked()') snooze(1) # no way to wait for a private signal pseudoTree = buildTreeFromOutline() # __writeOutlineFile__(pseudoTree, "focus.qml_mod3_outline.tsv") verifyOutline(pseudoTree, "focus.qml_mod3_outline.tsv") def performModification(afterLine, typing, markCount, markDirection, newText): global qmlEditor if not placeCursorToLine(qmlEditor, afterLine): return if typing: type(qmlEditor, typing) markText(qmlEditor, markDirection, markCount) type(qmlEditor, newText) # used to create the tsv file(s) def __writeOutlineFile__(outlinePseudoTree, filename): f = open(filename, "w+") f.write('"element"\t"nestinglevel"\t"value"\n') for elem in outlinePseudoTree: f.write('"%s"\t"%s"\t"%s"\n' % (elem[0], elem[1], elem[2].replace('"', '\"\"'))) f.close() def retrieveData(record): return (testData.field(record, "element"), __builtin__.int(testData.field(record, "nestinglevel")), testData.field(record, "value")) def verifyOutline(outlinePseudoTree, datasetFileName): fileName = datasetFileName[:datasetFileName.index("_")] expected = map(retrieveData, testData.dataset(datasetFileName)) if len(expected) != len(outlinePseudoTree): test.fail("Mismatch in length of expected and found elements of outline. Skipping " "verification of nodes.", "Found %d elements, but expected %d" % (len(outlinePseudoTree), len(expected))) return for counter, (expectedItem, foundItem) in enumerate(zip(expected, outlinePseudoTree)): if expectedItem != foundItem: test.fail("Mismatch in element number %d for '%s'" % (counter + 1, fileName), "%s != %s" % (str(expectedItem), str(foundItem))) return test.passes("All nodes (%d) inside outline match expected nodes for '%s'." % (len(expected), fileName))
#!/usr/bin/env python3 #-*- encoding: UTF-8 -*- # 2) Escreva um programa que leia um valor em metros e o exiba convertido em milímetros. def main(): medida = int(input("Informe a medida em metros: ")) print("A medida é %dmm" %(medida * 1000)) if __name__ == "__main__": main()
def extra_end(str): if len(str) <= 2: return (str * 3) return (str[-2:]*3)
class Obstacle(object): def __init__(self, position): self.position = position self.positionHistory = [position] self.ObstaclePotentialForces = []
math_symbolss = (('=', 'equal'), ('≠' , 'not equal'), ('≈', 'approximately equal'), ('#', 'number'), ('>', "greater than"), ('<', 'Less than'), ('+', 'plus'), ('-', 'minus'), ('*' , 'multiple'), ('×' , 'multiple'), ('÷', 'division'), ('/', 'division'), ('^', 'power'), ('%', 'percentage'), ('°' , 'degree'), ('π', 'pi'), ('∞', 'infinity'), ('∑', 'sigma'), ('∩' , 'intersection'), ('∪', 'union'), ('&', 'and'), ('∨', 'or'), ('℃', 'Degree Celsius'), ('℉', ' Degree Fahrenheit'), ('α', 'Alpha'), ('β', 'Beta'), ('γ', 'Gamma'), ('δ', 'Delta'), ('ε', 'Epsilon'), ('θ', 'Theta'), ('λ', 'Lambda'), ('μ', 'Mu')) def math_symbols_to_text(text): for i,a in math_symbolss: text = text.replace(i, a) return text
# commute_time = input("How long is your commute? (in minutes) ") # print( # ''' # –––––––––––––––––––––––––––––––––––––––––– # |Enter the letter for your means of transit| # | - - - - - - - - - - - - - - - - - - - - -| # |w - walk | # |b - bicycle | # |p - public transit | # |c - car | # –––––––––––––––––––––––––––––––––––––––––– # ''' # ) # #commute_method = input("How are you getting to your destination? ") location = "Seoul" weather = "Good" #Eventually, it might become worthwhile to upgrade to a custom feels like temperature calcuation based on the user's personal preferences. For now, the program will simply uses the feels like temp from Dark Sky's API for ease of building the first prototype. feels_like_temp = 72 clothing_rec = "Test" #Need to add functionality to check for rain def clothing_rec_engine(): if feels_like_temp < -20: clothing_rec = "Stay inside!" elif -20 <= feels_like_temp <= 20: clothing_rec + "Sweater & Winter Jacket" elif 20 < feels_like_temp <= 40: clothing_rec + "Winter Jacket" elif 40 < feels_like_temp <= 65: clothing_rec + "Sweater" elif 65 < feels_like_temp <= 100: clothing_rec = clothing_rec + "No Jacket" else: clothing_rec = "Stay Inside" print(clothing_rec) print(clothing_rec)
print('-=-=-=-= DESAFIO 104 -=-=-=-=') print() def leiaInt(msg): print('-'*45) inteiro = str(input(msg)) while not inteiro.isnumeric(): print(f'\033[31mERRO! Digite um número inteiro válido.\033[m') inteiro = str(input(msg)) if inteiro.isnumeric(): break return inteiro n = leiaInt('Digite um número: ') print(f'Você acabou de digitar o número {n}') print('-'*45) # RESOLUÇÃO do PROF: # def leiaInt(msg): # ok = False # valor = 0 # while True: # num = str(input(msg)) # if num.isnumeric(): # valor = int(num) # ok = True # else: # print('ERRO! Digite um número inteiro válido.') # if ok: # break # return valor
# Copyright (c) 2022 Dai HBG """ 该文件定义了所有Cython版本得默认算子字典 """ default_operation_dic = {'1': ['csrank', 'zscore', 'neg_2d', 'neg_3d', 'csindneutral', 'csind', 'absv_2d', 'absv_3d', 'log_2d', 'log_3d', 'logv_2d', 'logv_3d'], '1_num': ['wdirect', 'tsrank_2d', 'tsrank_3d', 'tskurtosis_2d', 'tskurtosis_3d', 'tsskew_2d', 'tsskew_3d', 'tsmean_2d', 'tsmean_3d', 'tsstd_2d', 'tsstd_3d', 'tsdelay_2d', 'tsdelay_3d', 'tsdelta_2d', 'tsdelta_3d t', 'tsmax_2d', 'tsmax_3d', 'tsmin_2d', 'tsmin_3d', 'tsmaxpos_2d', 'tsmaxpos_3d', 'tsminpos_2d', 'tsminpos_3d', 'powv_2d', 'powv_3d', 'tspct_2d', 'tspct_3d', 'discrete'], '1_num_num': ['intratsmax_3d', 'intratsmaxpos_3d', 'intratsmin_3d', 'intratsminpos_3d', 'intratsmean_3d', 'intratsstd_3d', 'tsfftreal', 'tsfftimag', 'tshpf', 'tslpf', 'tsquantile_2d', 'tsquantile_3d', 'tsquantileupmean_2d', 'tsquantileupmean_3d', 'tsquantiledownmean_2d', 'tsquantiledownmean_3d'], '1_num_num_num': ['intraquantile_3d', 'intraquantileupmean_3d', 'intraquantiledownmean_3d'], '2': ['add_2d', 'add_3d', 'add_num_2d', 'add_num_3d', 'minus_2d', 'minus_3d', 'minus_num_2d', 'minus_num_3d', 'prod_2d', 'prod_3d', 'prod_num_2d', 'prod_num_3d', 'div_2d', 'div_3d', 'div_num_2d', 'div_num_3d', 'lt_2d', 'lt_3d', 'le_2d', 'le_3d', 'gt_2d', 'gt_3d', 'ge_d', 'ge_3d', 'intratsregres_3d'], '2_num': ['tscorr_2d', 'tscorr_3d', 'tsregres_2d', 'tsregres_3d'], '2_num_num': ['intratscorr_3d', 'intratsregres_3d', 'bitsquantile_2d', 'bitsquantile_3d', 'bitsquantileupmean_2d', 'bitsquantileupmean_3d', 'bitsquantiledownmean_2d', 'bitsquantiledownmean_2d' ], '2_num_num_num': ['tssubset', 'biintraquantile_3d', 'biintraquantileupmean_3d', 'biintraquantiledownmean_3d'], '3': ['condition', 'tsautocorr'], 'intra_data': ['intra_open', 'intra_high', 'intra_low', 'intra_close', 'intra_avg', 'intra_volume', 'intra_money'] } default_dim_operation_dic = {'2_2': ['csrank', 'zscore', 'neg_2d', 'csindneutral', 'csind', 'absv_2d', 'wdirect', 'tsrank_2d', 'tskurtosis_2d', 'tsskew_2d', 'tsmean_2d', 'tsstd_2d', 'tsdelay_2d', 'tsdelta_2d', 'tsmax_2d', 'tsmin_2d', 'tsmaxpos_2d', 'tsminpos_2d', 'powv_2d', 'tspct_2d', 'add_2d', 'prod_2d', 'minus_2d', 'div_2d', 'lt_2d', 'le_2d', 'gt_2d', 'ge_2d', 'add_num_2d', 'prod_num_2d', 'minus_num_2d', 'div_num_2d', 'condition', 'tsautocorr', 'tssubset', 'tsfftreal', 'tsfftimag', 'tshpf', 'tslpf', 'tsquantile_2d', 'tsquantileupmean_2d', 'tsquantiledownmean_2d', 'bitsquantile_2d', 'bitsquantileupmean_2d', 'bitsquantiledownmean_2d', 'discrete', 'log_2d', 'logv_2d' ], '3_3': ['neg_3d', 'absv_3d', 'add_3d', 'prod_3d', 'minus_3d', 'div_3d', 'add_num_3d', 'prod_num_3d', 'minus_num_3d', 'div_num_3d', 'lt_3d', 'le_3d', 'gt_3d', 'ge_3d', 'log_3d', 'logv_3d', 'intratsregres_3d', 'intratsfftreal', 'intratsfftimag', 'intratshpf', 'intratslpf', 'tsquantile_3d', 'tsquantileupmean_3d', 'tsquantiledownmean_3d', 'biintraquantile_3d', 'biintraquantileupmean_3d', 'biintraquantiledownmean_3d'], '3_2': ['intratsmax', 'intratsmaxpos', 'intratsmin', 'intratsminpos', 'intratsmean', 'intratsstd', 'intratscorr', 'intraquantile', 'intraquantileupmean', 'intraquantiledownmean', 'biintraquantile', 'biintraquantileupmean', 'biintraquantiledownmean'] }
""" At_initial_setup module template Copy this module up one level to /gamesrc/conf, name it what you like and then use it as a template to modify. Then edit settings.AT_INITIAL_SETUP_HOOK_MODULE to point to your new module. Custom at_initial_setup method. This allows you to hook special modifications to the initial server startup process. Note that this will only be run once - when the server starts up for the very first time! It is called last in the startup process and can thus be used to overload things that happened before it. The module must contain a global function at_initial_setup(). This will be called without arguments. Note that tracebacks in this module will be QUIETLY ignored, so make sure to check it well to make sure it does what you expect it to. """ def at_initial_setup(): pass
# # PySNMP MIB module CISCO-UNIFIED-COMPUTING-LLDP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-LLDP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:16:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") CiscoNetworkAddress, CiscoAlarmSeverity, CiscoInetAddressMask, Unsigned64, TimeIntervalSec = mibBuilder.importSymbols("CISCO-TC", "CiscoNetworkAddress", "CiscoAlarmSeverity", "CiscoInetAddressMask", "Unsigned64", "TimeIntervalSec") ciscoUnifiedComputingMIBObjects, CucsManagedObjectDn, CucsManagedObjectId = mibBuilder.importSymbols("CISCO-UNIFIED-COMPUTING-MIB", "ciscoUnifiedComputingMIBObjects", "CucsManagedObjectDn", "CucsManagedObjectId") InetAddressIPv6, InetAddressIPv4 = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressIPv6", "InetAddressIPv4") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, ModuleIdentity, Unsigned32, Bits, ObjectIdentity, Counter64, MibIdentifier, TimeTicks, iso, IpAddress, Integer32, Gauge32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "ModuleIdentity", "Unsigned32", "Bits", "ObjectIdentity", "Counter64", "MibIdentifier", "TimeTicks", "iso", "IpAddress", "Integer32", "Gauge32", "Counter32") RowPointer, TimeInterval, TimeStamp, TruthValue, MacAddress, DisplayString, TextualConvention, DateAndTime = mibBuilder.importSymbols("SNMPv2-TC", "RowPointer", "TimeInterval", "TimeStamp", "TruthValue", "MacAddress", "DisplayString", "TextualConvention", "DateAndTime") cucsLldpObjects = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58)) if mibBuilder.loadTexts: cucsLldpObjects.setLastUpdated('201601180000Z') if mibBuilder.loadTexts: cucsLldpObjects.setOrganization('Cisco Systems Inc.') if mibBuilder.loadTexts: cucsLldpObjects.setContactInfo('Cisco Systems Customer Service Postal: 170 W Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553 -NETS E-mail: cs-san@cisco.com, cs-lan-switch-snmp@cisco.com') if mibBuilder.loadTexts: cucsLldpObjects.setDescription('MIB representation of the Cisco Unified Computing System LLDP management information model package') cucsLldpAcquiredTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1), ) if mibBuilder.loadTexts: cucsLldpAcquiredTable.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredTable.setDescription('Cisco UCS lldp:Acquired managed object table') cucsLldpAcquiredEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1), ).setIndexNames((0, "CISCO-UNIFIED-COMPUTING-LLDP-MIB", "cucsLldpAcquiredInstanceId")) if mibBuilder.loadTexts: cucsLldpAcquiredEntry.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredEntry.setDescription('Entry for the cucsLldpAcquiredTable table.') cucsLldpAcquiredInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 1), CucsManagedObjectId()) if mibBuilder.loadTexts: cucsLldpAcquiredInstanceId.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredInstanceId.setDescription('Instance identifier of the managed object.') cucsLldpAcquiredDn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 2), CucsManagedObjectDn()).setMaxAccess("readonly") if mibBuilder.loadTexts: cucsLldpAcquiredDn.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredDn.setDescription('Cisco UCS lldp:Acquired:dn managed object property') cucsLldpAcquiredRn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 3), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cucsLldpAcquiredRn.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredRn.setDescription('Cisco UCS lldp:Acquired:rn managed object property') cucsLldpAcquiredAcqts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 4), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: cucsLldpAcquiredAcqts.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredAcqts.setDescription('Cisco UCS lldp:Acquired:acqts managed object property') cucsLldpAcquiredChassisMac = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 5), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cucsLldpAcquiredChassisMac.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredChassisMac.setDescription('Cisco UCS lldp:Acquired:chassisMac managed object property') cucsLldpAcquiredPeerDn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 6), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cucsLldpAcquiredPeerDn.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredPeerDn.setDescription('Cisco UCS lldp:Acquired:peerDn managed object property') cucsLldpAcquiredPortMac = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 7), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cucsLldpAcquiredPortMac.setStatus('current') if mibBuilder.loadTexts: cucsLldpAcquiredPortMac.setDescription('Cisco UCS lldp:Acquired:portMac managed object property') mibBuilder.exportSymbols("CISCO-UNIFIED-COMPUTING-LLDP-MIB", cucsLldpObjects=cucsLldpObjects, cucsLldpAcquiredAcqts=cucsLldpAcquiredAcqts, cucsLldpAcquiredTable=cucsLldpAcquiredTable, cucsLldpAcquiredPeerDn=cucsLldpAcquiredPeerDn, cucsLldpAcquiredEntry=cucsLldpAcquiredEntry, cucsLldpAcquiredPortMac=cucsLldpAcquiredPortMac, cucsLldpAcquiredInstanceId=cucsLldpAcquiredInstanceId, PYSNMP_MODULE_ID=cucsLldpObjects, cucsLldpAcquiredRn=cucsLldpAcquiredRn, cucsLldpAcquiredDn=cucsLldpAcquiredDn, cucsLldpAcquiredChassisMac=cucsLldpAcquiredChassisMac)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # input input_data = [] with open('input.txt', 'r') as f: lines = f.readlines() input_data = [l.strip().split(')') for l in lines] # structures orbits_down = dict(zip([inp[1] for inp in input_data], [inp[0] for inp in input_data])) # task 1 total = 0 all_centers = orbits_down.values() for center, satellite in orbits_down.items(): current = 0 current += satellite not in all_centers next_center = center while next_center != 'COM': current += 1 next_center = orbits_down[next_center] total += current print(total) # task 2 def track(satellite): trace = [] center = orbits_down[satellite] while center != 'COM': trace.append(center) center = orbits_down[center] return trace trace_you = track('YOU') trace_san = track('SAN') last_common = 'COM' while True: if trace_you[-1] == trace_san[-1]: last_common = trace_san[-1] trace_you.pop() trace_san.pop() else: break print(len(trace_you) + len(trace_san))
# -*- coding: utf-8 -*- PORT = 7373 CFG_PREP = '/set ' CFG_PREP_LEN = len(CFG_PREP) PROTOCOL_RE = '^SCC_0.1:([0-9]+);(?:([a-zA-Z0-9_\-!§$%&()#+*~]+);){2}>>(.+)$' def protocol(sender, recepient, message): return 'SCC_0.1:' + str(len(message)) + ';' + str(sender) + ';' + str(recepient) + ';>>' + str(message)
""" DockCI exceptions """ class InvalidOperationError(Exception): """ Raised when a call is not valid at the current time """ pass class AlreadyBuiltError(Exception): """ Raised when a versioned build already exists in the repository """ pass class AlreadyRunError(InvalidOperationError): """ Raised when a build or stage is attempted to be run that has already been started/completed """ runnable = None def __init__(self, runnable): super(AlreadyRunError, self).__init__() self.runnable = runnable
def Num14681(): x = int(input()) y = int(input()) result = 0 if x > 0: if y > 0: result = 1 else: result = 4 else: if y < 0: result = 3 else: result = 2 print(str(result)) Num14681()
#Given an array of integers, find the one that appears an odd number of times. #There will always be only one integer that appears an odd number of times. def find_it(arr): res = 0 for element in arr: res = res ^ element return res
#网络类型 # net_model = ['CNN','MobileNet','ResNet','FCNet','VAE','Auto_encoder'] net_model = ['CNN','MobileNet','ResNet','FCNet'] #激活函数 Activation_Function = ['E-Sigmod','Tanh','ReLU','ELU','PReLU','Leaky ReLU'] #优化器 optimizer = ['Adam','SGD','BGD','Adagrad','Adadelta','RMSprop'] #损失函数 Net_losses = ['mse','cross_entropy','combin_loss','exponential_Loss','hinge_loss'] #机器学习模型 ml_model = ['SVM','DT','Gauss'] #模型类别 分为两种 model_class = ['Deep Learning', 'Machine Learning'] #机器学习模型 batch_size = [2,4,8,16,32,64,128,256,512,1024] Whether_data_augment = ['否','是'] #输入维度 #输出维度 #网络层数 #学习率 #迭代步数 #权值衰减
def Filtra_Tupla(lista): # Serão adicionadas à saída tuplas cujo valor # não seja vazio. saida = [tupla for tupla in lista if tupla] return saida tuplas = [(), (0, "ABC", 24), (), (1, "BCD", 46), (2, "CDE", 70), (3, "DEF", 13), ()] print(Filtra_Tupla(tuplas)) # SAIDA: # >> [(0, 'ABC', 24), (1, 'BCD', 46), (2, 'CDE', 70), (3, 'DEF', 13)]
__author__ = 'samantha' def checkio(words): #l = list() #for word in words.split(): # l.append(word.isalpha()) print(words) res = False l = [wd.isalpha() for wd in words.split()] #r = [l[i:i+3] for i in range(0,len(l)-3) ] #print ('r=',r) print ('l=',l) if len(l)>3: print ('len(l)=', len(l)) print('range', range(0,len(l)-2)) for i in range(0,(len(l)-2)): print ('i=', i) l2 = l[i:i+3] print('l2=', l2) res = all(x == True for x in l2) print ('res=', res) elif len(l) == 3: res = all(x == True for x in l) return res #These "asserts" using only for self-checking and not necessary for auto-testing if __name__ == '__main__': assert checkio("Hello World hello") == True, "Hello" assert checkio("He is 123 man") == False, "123 man" assert checkio("1 2 3 4") == False, "Digits" assert checkio("bla bla bla bla") == True, "Bla Bla" assert checkio("Hi") == False, "Hi" assert checkio("0 qwerty iddqd asdfg") == True, "0 qwert"
# Crie um programa que leia o nome completo de uma pessoa e mostre: # O nome com todas as letras maiúsculas e minúsculas. # Quantas letras ao todo (sem considerar espaços). # Quantas letras tem o primeiro nome. n = str(input('Digite seu nome completo: ')).strip() print('Analisando o seu nome...') print('Seu nome em maiúsculas é {}' .format(n.upper())) print('Seu nome em minúsculas é {}' .format(n.lower())) print('Seu nome ao todo tem {} letras' .format(len(n) - n.count(' '))) print('Seu primeiro nome tem {} letras' .format(n.find(' ')))
class FrontendPortTotalThroughput(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_frontend_port_total_iops(idx_name) class FrontendPortTotalThroughputColumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_frontend_ports()
DEBUG = True MOLLIE_API_KEY = '' REDIS_HOST = 'localhost' COOKIE_NAME = 'Paywall-Voucher' CSRF_SECRET_KEY = 'NeVeR WoUnD a SnAke KiLl It'
def field_validator(keys, data_): """ Validates the submitted data are POSTed with the required fields :param keys: :param data_: :return: """ data = {} for v in keys: if v not in data_: data[v] = ["This field may not be null."] if len(data) != 0: return {"success": False, "data": data} elif len(data) == 0: return {"success": True, "data": data}
# Copyright 2017 Rice University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. LABELS = ['swing', 'awt', 'security', 'sql', 'net', 'xml', 'crypto', 'math'] def get_api(config, calls, apiOrNot): apis = [] for call, api_bool in zip(calls, apiOrNot): if api_bool and call > 0: api = config.vocab.chars_api[call] apis.append(api) apis_ = [] for api in apis: try: api_mid = api.split('.')[1] except: api_mid = [] apis_.append(api_mid) guard = [] for api in apis_: if api in LABELS: label = api guard.append(label) if len(set(guard)) != 1: return 'N/A' else: return guard[0]
""" Refaça o Exercício 051, lendo o primeiro termo e a razão de uma PA, mostrando os 10 primeiros termos da progressão usando a estrutura while. """ ptermo = int(input('Digite o primeiro termo da PA: ')) razao = int(input('Digite a razão: ')) c = 0 termo = 0 print('PA: ', end='') while c != 10: termo = ptermo + c * razao print(termo, end=' ') c += 1
__all__ = ['VERSION'] VERSION = '7.6.0' SAVE_PATH = '~/.spotifydl' SPOTIPY_CLIENT_ID = "4fe3fecfe5334023a1472516cc99d805" SPOTIPY_CLIENT_SECRET = "0f02b7c483c04257984695007a4a8d5c"
#!/usr/bin/env python3 print("Hello Inderpal Singh!") print("Welcome to python scripting.") print("Learning python opens new doors of opportunity.")
while True: try: bil = input("masukan bilangan: ") bil = int(bil) break except ValueError: print("anda salah memasukan bilangan") print("anda memasukan bilangan %s, data harus angka" % bil ) print("anda memasukan bilangan", bil)
class ViewportInfo(object,IDisposable,ISerializable): """ Represents a viewing frustum. ViewportInfo() ViewportInfo(other: ViewportInfo) ViewportInfo(rhinoViewport: RhinoViewport) """ def ChangeToParallelProjection(self,symmetricFrustum): """ ChangeToParallelProjection(self: ViewportInfo,symmetricFrustum: bool) -> bool Use this function to change projections of valid viewports from parallel to perspective. It will make common additional adjustments to the frustum and camera location so the resulting views are similar. The camera direction and target point are not be changed. If the current projection is parallel and symmetricFrustum, FrustumIsLeftRightSymmetric() and FrustumIsTopBottomSymmetric() are all equal,then no changes are made and true is returned. symmetricFrustum: true if you want the resulting frustum to be symmetric. Returns: true if the operation succeeded; otherwise,false. """ pass def ChangeToPerspectiveProjection(self,targetDistance,symmetricFrustum,lensLength): """ ChangeToPerspectiveProjection(self: ViewportInfo,targetDistance: float,symmetricFrustum: bool,lensLength: float) -> bool Use this function to change projections of valid viewports from parallel to perspective. It will make common additional adjustments to the frustum and camera location so the resulting views are similar. The camera direction and target point are not changed. If the current projection is perspective and symmetricFrustum, IsFrustumIsLeftRightSymmetric,and IsFrustumIsTopBottomSymmetric are all equal,then no changes are made and true is returned. targetDistance: If RhinoMath.UnsetValue this parameter is ignored. Otherwise it must be > 0 and indicates which plane in the current view frustum should be perserved. symmetricFrustum: true if you want the resulting frustum to be symmetric. lensLength: (pass 50.0 when in doubt) 35 mm lens length to use when changing from parallel to perspective projections. If the current projection is perspective or lens_length is <= 0.0, then this parameter is ignored. Returns: true if the operation succeeded; otherwise,false. """ pass def ChangeToSymmetricFrustum(self,isLeftRightSymmetric,isTopBottomSymmetric,targetDistance): """ ChangeToSymmetricFrustum(self: ViewportInfo,isLeftRightSymmetric: bool,isTopBottomSymmetric: bool,targetDistance: float) -> bool If needed,adjusts the current frustum so it has the specified symmetries and adjust the camera location so the target plane remains visible. isLeftRightSymmetric: If true,the frustum will be adjusted so left=-right. isTopBottomSymmetric: If true,the frustum will be adjusted so top=-bottom. targetDistance: If projection is not perspective or target_distance is RhinoMath.UnsetValue, then this parameter is ignored. If the projection is perspective and targetDistance is not RhinoMath.UnsetValue,then it must be > 0.0 and it is used to determine which plane in the old frustum will appear unchanged in the new frustum. Returns: Returns true if the viewport has now a frustum with the specified symmetries. """ pass def ChangeToTwoPointPerspectiveProjection(self,targetDistance,up,lensLength): """ ChangeToTwoPointPerspectiveProjection(self: ViewportInfo,targetDistance: float,up: Vector3d,lensLength: float) -> bool Changes projections of valid viewports to a two point perspective. It will make common additional adjustments to the frustum and camera location and direction so the resulting views are similar. If the current projection is perspective and IsFrustumIsLeftRightSymmetric is true and IsFrustumIsTopBottomSymmetric is false,then no changes are made and true is returned. targetDistance: If RhinoMath.UnsetValue this parameter is ignored. Otherwise it must be > 0 and indicates which plane in the current view frustum should be perserved. up: The locked up direction. Pass Vector3d.Zero if you want to use the world axis direction that is closest to the current up direction. Pass CameraY() if you want to preserve the current up direction. lensLength: (pass 50.0 when in doubt) 35 mm lens length to use when changing from parallel to perspective projections. If the current projection is perspective or lens_length is <= 0.0, then this parameter is ignored. Returns: true if the operation succeeded; otherwise,false. """ pass def Dispose(self): """ Dispose(self: ViewportInfo) Actively reclaims unmanaged resources that this instance uses. """ pass def DollyCamera(self,dollyVector): """ DollyCamera(self: ViewportInfo,dollyVector: Vector3d) -> bool DollyCamera() does not update the frustum's clipping planes. To update the frustum's clipping planes call DollyFrustum(d) with d=dollyVector o cameraFrameZ. To convert screen locations into a dolly vector,use GetDollyCameraVector(). Does not update frustum. To update frustum use DollyFrustum(d) with d=dollyVector o cameraFrameZ. dollyVector: dolly vector in world coordinates. Returns: true if the operation succeeded; otherwise,false. """ pass def DollyExtents(self,*__args): """ DollyExtents(self: ViewportInfo,cameraCoordinateBoundingBox: BoundingBox,border: float) -> bool Dolly the camera location and so that the view frustum contains all of the document objects that can be seen in view. If the projection is perspective,the camera angle is not changed. border: If border > 1.0,then the fustum in enlarged by this factor to provide a border around the view. 1.1 works well for parallel projections; 0.0 is suggested for perspective projections. Returns: True if successful. DollyExtents(self: ViewportInfo,geometry: IEnumerable[GeometryBase],border: float) -> bool """ pass def DollyFrustum(self,dollyDistance): """ DollyFrustum(self: ViewportInfo,dollyDistance: float) -> bool Moves the frustum clipping planes. dollyDistance: Distance to move in camera direction. Returns: true if the operation succeeded; otherwise,false. """ pass def Extents(self,halfViewAngleRadians,*__args): """ Extents(self: ViewportInfo,halfViewAngleRadians: float,sphere: Sphere) -> bool Extends this viewport view to include a sphere. Use Extents() as a quick way to set a viewport to so that bounding volume is inside of a viewports frustrum. The view angle is used to determine the position of the camera. halfViewAngleRadians: 1/2 smallest subtended view angle in radians. sphere: A sphere in 3d world coordinates. Returns: true if the operation succeeded; otherwise,false. Extents(self: ViewportInfo,halfViewAngleRadians: float,bbox: BoundingBox) -> bool Extends this viewport view to include a bounding box. Use Extents() as a quick way to set a viewport to so that bounding volume is inside of a viewports frustrum. The view angle is used to determine the position of the camera. halfViewAngleRadians: 1/2 smallest subtended view angle in radians. bbox: A bounding box in 3d world coordinates. Returns: true if the operation succeeded; otherwise,false. """ pass def FrustumCenterPoint(self,targetDistance): """ FrustumCenterPoint(self: ViewportInfo,targetDistance: float) -> Point3d Return a point on the central axis of the view frustum. This point is a good choice for a general purpose target point. targetDistance: If targetDistance > 0.0,then the distance from the returned point to the camera plane will be targetDistance. Note that if the frustum is not symmetric,the distance from the returned point to the camera location will be larger than targetDistance. If targetDistance == ON_UNSET_VALUE and the frustum is valid with near > 0.0,then 0.5*(near + far) will be used as the targetDistance. Returns: A point on the frustum's central axis. If the viewport or input is not valid,then ON_3dPoint::UnsetPoint is returned. """ pass def GetBoundingBoxDepth(self,bbox,nearDistance,farDistance): """ GetBoundingBoxDepth(self: ViewportInfo,bbox: BoundingBox) -> (bool,float,float) Gets near and far clipping distances of a bounding box. This function ignores the current value of the viewport's near and far settings. If the viewport is a perspective projection,the it intersects the semi infinite frustum volume with the bounding box and returns the near and far distances of the intersection. If the viewport is a parallel projection,it instersects the infinte view region with the bounding box and returns the near and far distances of the projection. bbox: The bounding box to sample. Returns: true if the bounding box intersects the view frustum and near_dist/far_dist were set. false if the bounding box does not intesect the view frustum. """ pass def GetCameraAngles(self,halfDiagonalAngleRadians,halfVerticalAngleRadians,halfHorizontalAngleRadians): """ GetCameraAngles(self: ViewportInfo) -> (bool,float,float,float) Gets the field of view angles. Returns: true if the operation succeeded; otherwise,false. """ pass def GetCameraFrame(self,location,cameraX,cameraY,cameraZ): """ GetCameraFrame(self: ViewportInfo) -> (bool,Point3d,Vector3d,Vector3d,Vector3d) Gets location and vectors of this camera. Returns: true if current camera orientation is valid; otherwise false. """ pass def GetDollyCameraVector(self,*__args): """ GetDollyCameraVector(self: ViewportInfo,screen0: Point,screen1: Point,projectionPlaneDistance: float) -> Vector3d Gets a world coordinate dolly vector that can be passed to DollyCamera(). screen0: Start point. screen1: End point. projectionPlaneDistance: Distance of projection plane from camera. When in doubt,use 0.5*(frus_near+frus_far). Returns: The world coordinate dolly vector. GetDollyCameraVector(self: ViewportInfo,screenX0: int,screenY0: int,screenX1: int,screenY1: int,projectionPlaneDistance: float) -> Vector3d Gets a world coordinate dolly vector that can be passed to DollyCamera(). screenX0: Screen coords of start point. screenY0: Screen coords of start point. screenX1: Screen coords of end point. screenY1: Screen coords of end point. projectionPlaneDistance: Distance of projection plane from camera. When in doubt,use 0.5*(frus_near+frus_far). Returns: The world coordinate dolly vector. """ pass def GetFarPlaneCorners(self): """ GetFarPlaneCorners(self: ViewportInfo) -> Array[Point3d] Gets the corners of far clipping plane rectangle. 4 points are returned in the order of bottom left,bottom right, top left,top right. Returns: Four corner points on success. Empty array if viewport is not valid. """ pass def GetFrustum(self,left,right,bottom,top,nearDistance,farDistance): """ GetFrustum(self: ViewportInfo) -> (bool,float,float,float,float,float,float) Gets the view frustum. Returns: true if operation succeeded; otherwise,false. """ pass def GetFrustumLine(self,*__args): """ GetFrustumLine(self: ViewportInfo,screenPoint: PointF) -> Line Gets the world coordinate line in the view frustum that projects to a point on the screen. screenPoint: screen location Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far clipping plane. GetFrustumLine(self: ViewportInfo,screenPoint: Point) -> Line Gets the world coordinate line in the view frustum that projects to a point on the screen. screenPoint: screen location Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far clipping plane. GetFrustumLine(self: ViewportInfo,screenX: float,screenY: float) -> Line Gets the world coordinate line in the view frustum that projects to a point on the screen. screenX: (screenx,screeny)=screen location. screenY: (screenx,screeny)=screen location. Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far clipping plane. """ pass def GetNearPlaneCorners(self): """ GetNearPlaneCorners(self: ViewportInfo) -> Array[Point3d] Gets the corners of near clipping plane rectangle. 4 points are returned in the order of bottom left,bottom right, top left,top right. Returns: Four corner points on success. Empty array if viewport is not valid. """ pass def GetObjectData(self,info,context): """ GetObjectData(self: ViewportInfo,info: SerializationInfo,context: StreamingContext) Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object. info: The System.Runtime.Serialization.SerializationInfo to populate with data. context: The destination (see System.Runtime.Serialization.StreamingContext) for this serialization. """ pass def GetPointDepth(self,point,distance): """ GetPointDepth(self: ViewportInfo,point: Point3d) -> (bool,float) Gets the clipping distance of a point. This function ignores the current value of the viewport's near and far settings. If the viewport is a perspective projection, then it intersects the semi infinite frustum volume with the bounding box and returns the near and far distances of the intersection. If the viewport is a parallel projection,it instersects the infinte view region with the bounding box and returns the near and far distances of the projection. point: A point to measure. Returns: true if the bounding box intersects the view frustum and near_dist/far_dist were set. false if the bounding box does not intesect the view frustum. """ pass def GetScreenPort(self,near=None,far=None): """ GetScreenPort(self: ViewportInfo) -> Rectangle Gets the location of viewport in pixels. See documentation for Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S ystem.Int32,System.Int32)SetScreenPort. Returns: The rectangle,or System.Drawing.Rectangle.EmptyEmpty rectangle on error. GetScreenPort(self: ViewportInfo) -> (Rectangle,int,int) Gets the location of viewport in pixels. See value meanings in Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S ystem.Int32,System.Int32)SetScreenPort. Returns: The rectangle,or System.Drawing.Rectangle.EmptyEmpty rectangle on error. """ pass def GetSphereDepth(self,sphere,nearDistance,farDistance): """ GetSphereDepth(self: ViewportInfo,sphere: Sphere) -> (bool,float,float) Gets near and far clipping distances of a bounding sphere. sphere: The sphere to sample. Returns: true if the sphere intersects the view frustum and near_dist/far_dist were set. false if the sphere does not intesect the view frustum. """ pass def GetWorldToScreenScale(self,pointInFrustum): """ GetWorldToScreenScale(self: ViewportInfo,pointInFrustum: Point3d) -> float Gets the scale factor from point in frustum to screen scale. pointInFrustum: point in viewing frustum. Returns: number of pixels per world unit at the 3d point. """ pass def GetXform(self,sourceSystem,destinationSystem): """ GetXform(self: ViewportInfo,sourceSystem: CoordinateSystem,destinationSystem: CoordinateSystem) -> Transform Computes a transform from a coordinate system to another. sourceSystem: The coordinate system to map from. destinationSystem: The coordinate system to map into. Returns: The 4x4 transformation matrix (acts on the left). """ pass def SetCameraDirection(self,direction): """ SetCameraDirection(self: ViewportInfo,direction: Vector3d) -> bool Sets the direction that the camera faces. direction: A new direction. Returns: true if the direction was set; otherwise false. """ pass def SetCameraLocation(self,location): """ SetCameraLocation(self: ViewportInfo,location: Point3d) -> bool Sets the camera location (position) point. Returns: true if the operation succeeded; otherwise,false. """ pass def SetCameraUp(self,up): """ SetCameraUp(self: ViewportInfo,up: Vector3d) -> bool Sets the camera up vector. up: A new direction. Returns: true if the direction was set; otherwise false. """ pass def SetFrustum(self,left,right,bottom,top,nearDistance,farDistance): """ SetFrustum(self: ViewportInfo,left: float,right: float,bottom: float,top: float,nearDistance: float,farDistance: float) -> bool Sets the view frustum. If FrustumSymmetryIsLocked() is true and left != -right or bottom != -top,then they will be adjusted so the resulting frustum is symmetric. left: A new left value. right: A new right value. bottom: A new bottom value. top: A new top value. nearDistance: A new near distance value. farDistance: A new far distance value. Returns: true if operation succeeded; otherwise,false. """ pass def SetFrustumNearFar(self,*__args): """ SetFrustumNearFar(self: ViewportInfo,nearDistance: float,farDistance: float) -> bool Sets the frustum near and far distances using two values. nearDistance: The new near distance. farDistance: The new far distance. Returns: true if operation succeeded; otherwise,false. SetFrustumNearFar(self: ViewportInfo,nearDistance: float,farDistance: float,minNearDistance: float,minNearOverFar: float,targetDistance: float) -> bool Sets near and far clipping distance subject to constraints. nearDistance: (>0) desired near clipping distance. farDistance: (>near_dist) desired near clipping distance. minNearDistance: If min_near_dist <= 0.0,it is ignored. If min_near_dist > 0 and near_dist < min_near_dist,then the frustum's near_dist will be increased to min_near_dist. minNearOverFar: If min_near_over_far <= 0.0,it is ignored. If near_dist < far_dist*min_near_over_far,then near_dist is increased and/or far_dist is decreased so that near_dist=far_dist*min_near_over_far. If near_dist < target_dist < far_dist,then near_dist near_dist is increased and far_dist is decreased so that projection precision will be good at target_dist. Otherwise,near_dist is simply set to far_dist*min_near_over_far. targetDistance: If target_dist <= 0.0,it is ignored. If target_dist > 0,it is used as described in the description of the min_near_over_far parameter. Returns: true if operation succeeded; otherwise,false. SetFrustumNearFar(self: ViewportInfo,boundingBox: BoundingBox) -> bool Sets the frustum near and far using a bounding box. boundingBox: A bounding box to use. Returns: true if operation succeeded; otherwise,false. SetFrustumNearFar(self: ViewportInfo,center: Point3d,radius: float) -> bool Sets the frustum near and far using a center point and radius. center: A center point. radius: A radius value. Returns: true if operation succeeded; otherwise,false. """ pass def SetScreenPort(self,*__args): """ SetScreenPort(self: ViewportInfo,windowRectangle: Rectangle) -> bool Gets the location of viewport in pixels. See value meanings in Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S ystem.Int32,System.Int32)SetScreenPort. windowRectangle: A new rectangle. Returns: true if input is valid. SetScreenPort(self: ViewportInfo,windowRectangle: Rectangle,near: int,far: int) -> bool Gets the location of viewport in pixels. See value meanings in Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S ystem.Int32,System.Int32)SetScreenPort. windowRectangle: A new rectangle. near: The near value. far: The far value. Returns: true if input is valid. SetScreenPort(self: ViewportInfo,left: int,right: int,bottom: int,top: int,near: int,far: int) -> bool Location of viewport in pixels. These are provided so you can set the port you are using and get the appropriate transformations to and from screen space. // For a Windows window / int width=width of window client area in pixels; / int height=height of window client area in pixels; / port_left=0; / port_right=width; / port_top=0; / port_bottom=height; / port_near=0; / port_far=1; / SetScreenPort( port_left,port_right, / port_bottom,port_top, / port_near, port_far ); left: A left value. right: A left value. (port_left != port_right) bottom: A bottom value. top: A top value. (port_top != port_bottom) near: A near value. far: A far value. Returns: true if input is valid. """ pass def TargetDistance(self,useFrustumCenterFallback): """ TargetDistance(self: ViewportInfo,useFrustumCenterFallback: bool) -> float Gets the distance from the target point to the camera plane. Note that if the frustum is not symmetric,then this distance is shorter than the distance from the target to the camera location. useFrustumCenterFallback: If bUseFrustumCenterFallback is false and the target point is not valid,then ON_UNSET_VALUE is returned. If bUseFrustumCenterFallback is true and the frustum is valid and current target point is not valid or is behind the camera, then 0.5*(near + far) is returned. Returns: Shortest signed distance from camera plane to target point. If the target point is on the visible side of the camera, a positive value is returned. ON_UNSET_VALUE is returned when the input of view is not valid. """ pass def UnlockCamera(self): """ UnlockCamera(self: ViewportInfo) Unlocks the camera vectors and location. """ pass def UnlockFrustumSymmetry(self): """ UnlockFrustumSymmetry(self: ViewportInfo) Unlocks frustum horizontal and vertical symmetries. """ pass def ZoomToScreenRect(self,*__args): """ ZoomToScreenRect(self: ViewportInfo,windowRectangle: Rectangle) -> bool Zooms to a screen zone. View changing from screen input points. Handy for using a mouse to manipulate a view. ZoomToScreenRect() may change camera and frustum settings. windowRectangle: The new window rectangle in screen space. Returns: true if the operation succeeded; otherwise,false. ZoomToScreenRect(self: ViewportInfo,left: int,top: int,right: int,bottom: int) -> bool Zooms to a screen zone. View changing from screen input points. Handy for using a mouse to manipulate a view. ZoomToScreenRect() may change camera and frustum settings. left: Screen coord. top: Screen coord. right: Screen coord. bottom: Screen coord. Returns: true if the operation succeeded; otherwise,false. """ pass def __enter__(self,*args): """ __enter__(self: IDisposable) -> object Provides the implementation of __enter__ for objects which implement IDisposable. """ pass def __exit__(self,*args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) Provides the implementation of __exit__ for objects which implement IDisposable. """ pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self,*__args): """ __new__(cls: type) __new__(cls: type,other: ViewportInfo) __new__(cls: type,rhinoViewport: RhinoViewport) """ pass def __reduce_ex__(self,*args): pass def __repr__(self,*args): """ __repr__(self: object) -> str """ pass Camera35mmLensLength=property(lambda self: object(),lambda self,v: None,lambda self: None) """This property assumes the camera is horizontal and crop the film rather than the image when the aspect of the frustum is not 36/24. (35mm film is 36mm wide and 24mm high.) Setting preserves camera location, changes the frustum,but maintains the frustum's aspect. Get: Camera35mmLensLength(self: ViewportInfo) -> float Set: Camera35mmLensLength(self: ViewportInfo)=value """ CameraAngle=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the 1/2 smallest angle. See Rhino.DocObjects.ViewportInfo.GetCameraAngles(System.Double@,System.Double@,System.Double@) for more information. Get: CameraAngle(self: ViewportInfo) -> float Set: CameraAngle(self: ViewportInfo)=value """ CameraDirection=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the direction that the camera faces. Get: CameraDirection(self: ViewportInfo) -> Vector3d """ CameraLocation=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the camera location (position) point. Get: CameraLocation(self: ViewportInfo) -> Point3d """ CameraUp=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the camera up vector. Get: CameraUp(self: ViewportInfo) -> Vector3d """ CameraX=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the unit "to the right" vector. Get: CameraX(self: ViewportInfo) -> Vector3d """ CameraY=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the unit "up" vector. Get: CameraY(self: ViewportInfo) -> Vector3d """ CameraZ=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the unit vector in -CameraDirection. Get: CameraZ(self: ViewportInfo) -> Vector3d """ FrustumAspect=property(lambda self: object(),lambda self,v: None,lambda self: None) """Setting FrustumAspect changes the larger of the frustum's width/height so that the resulting value of width/height matches the requested aspect. The camera angle is not changed. If you change the shape of the view port with a call SetScreenPort(),then you generally want to call SetFrustumAspect() with the value returned by GetScreenPortAspect(). Get: FrustumAspect(self: ViewportInfo) -> float Set: FrustumAspect(self: ViewportInfo)=value """ FrustumBottom=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum bottom value. This is -top if the frustum has a horizontal symmetry axis. This number is usually negative. Get: FrustumBottom(self: ViewportInfo) -> float """ FrustumBottomPlane=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum bottom plane that separates visibile from off-screen. Get: FrustumBottomPlane(self: ViewportInfo) -> Plane """ FrustumCenter=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum center point. Get: FrustumCenter(self: ViewportInfo) -> Point3d """ FrustumFar=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum far-cutting value. Get: FrustumFar(self: ViewportInfo) -> float """ FrustumFarPlane=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets far clipping plane if camera and frustum are valid. The plane's frame is the same as the camera's frame. The origin is located at the intersection of the camera direction ray and the far clipping plane. The plane's normal points into the frustum towards the camera location. Get: FrustumFarPlane(self: ViewportInfo) -> Plane """ FrustumHeight=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum height. This is Rhino.DocObjects.ViewportInfo.FrustumTop - Rhino.DocObjects.ViewportInfo.FrustumBottom. Get: FrustumHeight(self: ViewportInfo) -> float """ FrustumLeft=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum left value. This is -right if the frustum has a vertical symmetry axis. This number is usually negative. Get: FrustumLeft(self: ViewportInfo) -> float """ FrustumLeftPlane=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum left plane that separates visibile from off-screen. Get: FrustumLeftPlane(self: ViewportInfo) -> Plane """ FrustumMaximumDiameter=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum maximum diameter,or the maximum between Rhino.DocObjects.ViewportInfo.FrustumWidth and Rhino.DocObjects.ViewportInfo.FrustumHeight. Get: FrustumMaximumDiameter(self: ViewportInfo) -> float """ FrustumMinimumDiameter=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum minimum diameter,or the minimum between Rhino.DocObjects.ViewportInfo.FrustumWidth and Rhino.DocObjects.ViewportInfo.FrustumHeight. Get: FrustumMinimumDiameter(self: ViewportInfo) -> float """ FrustumNear=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum near-cutting value. Get: FrustumNear(self: ViewportInfo) -> float """ FrustumNearPlane=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets near clipping plane if camera and frustum are valid. The plane's frame is the same as the camera's frame. The origin is located at the intersection of the camera direction ray and the near clipping plane. The plane's normal points out of the frustum towards the camera location. Get: FrustumNearPlane(self: ViewportInfo) -> Plane """ FrustumRight=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum right value. This is -left if the frustum has a vertical symmetry axis. This number is usually positive. Get: FrustumRight(self: ViewportInfo) -> float """ FrustumRightPlane=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum right plane that separates visibile from off-screen. Get: FrustumRightPlane(self: ViewportInfo) -> Plane """ FrustumTop=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum top value. This is -bottom if the frustum has a horizontal symmetry axis. This number is usually positive. Get: FrustumTop(self: ViewportInfo) -> float """ FrustumTopPlane=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum top plane that separates visibile from off-screen. Get: FrustumTopPlane(self: ViewportInfo) -> Plane """ FrustumWidth=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the frustum width. This is Rhino.DocObjects.ViewportInfo.FrustumRight - Rhino.DocObjects.ViewportInfo.FrustumLeft. Get: FrustumWidth(self: ViewportInfo) -> float """ Id=property(lambda self: object(),lambda self,v: None,lambda self: None) """Sets the viewport's id to the value used to uniquely identify this viewport. There is no approved way to change the viewport id once it is set in order to maintain consistency across multiple viewports and those routines that manage them. Get: Id(self: ViewportInfo) -> Guid """ IsCameraDirectionLocked=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether the direction that the camera faces is unmodifiable. Get: IsCameraDirectionLocked(self: ViewportInfo) -> bool Set: IsCameraDirectionLocked(self: ViewportInfo)=value """ IsCameraLocationLocked=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether the camera location is unmodifiable. Get: IsCameraLocationLocked(self: ViewportInfo) -> bool Set: IsCameraLocationLocked(self: ViewportInfo)=value """ IsCameraUpLocked=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether the camera up vector is unmodifiable. Get: IsCameraUpLocked(self: ViewportInfo) -> bool Set: IsCameraUpLocked(self: ViewportInfo)=value """ IsFrustumLeftRightSymmetric=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether the camera frustum has a vertical symmetry axis. Get: IsFrustumLeftRightSymmetric(self: ViewportInfo) -> bool Set: IsFrustumLeftRightSymmetric(self: ViewportInfo)=value """ IsFrustumTopBottomSymmetric=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether the camera frustum has a horizontal symmetry axis. Get: IsFrustumTopBottomSymmetric(self: ViewportInfo) -> bool Set: IsFrustumTopBottomSymmetric(self: ViewportInfo)=value """ IsParallelProjection=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get or set whether this projection is parallel. Get: IsParallelProjection(self: ViewportInfo) -> bool Set: IsParallelProjection(self: ViewportInfo)=value """ IsPerspectiveProjection=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get or set whether this projection is perspective. Get: IsPerspectiveProjection(self: ViewportInfo) -> bool Set: IsPerspectiveProjection(self: ViewportInfo)=value """ IsTwoPointPerspectiveProjection=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets a value that indicates whether this projection is a two-point perspective. Get: IsTwoPointPerspectiveProjection(self: ViewportInfo) -> bool """ IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets a value that indicates whether this complete object is valid. Get: IsValid(self: ViewportInfo) -> bool """ IsValidCamera=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets a value that indicates whether the camera is valid. Get: IsValidCamera(self: ViewportInfo) -> bool """ IsValidFrustum=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets a value that indicates whether the frustum is valid. Get: IsValidFrustum(self: ViewportInfo) -> bool """ ScreenPortAspect=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the sceen aspect ratio. This is width / height. Get: ScreenPortAspect(self: ViewportInfo) -> float """ TargetPoint=property(lambda self: object(),lambda self,v: None,lambda self: None) """The current value of the target point. This point does not play a role in the view projection calculations. It can be used as a fixed point when changing the camera so the visible regions of the before and after frustums both contain the region of interest. The default constructor sets this point on ON_3dPoint::UnsetPoint. You must explicitly call one SetTargetPoint() functions to set the target point. Get: TargetPoint(self: ViewportInfo) -> Point3d Set: TargetPoint(self: ViewportInfo)=value """ ViewScale=property(lambda self: object(),lambda self,v: None,lambda self: None) """Applies scaling factors to parallel projection clipping coordinates by setting the m_clip_mod transformation. If you want to compress the view projection across the viewing plane,then set x=0.5,y=1.0,and z=1.0. Get: ViewScale(self: ViewportInfo) -> SizeF Set: ViewScale(self: ViewportInfo)=value """ # variables with complex values
n = int(input('Insira um número: ')) if n % 2 != 0 and n != 0 and n != 1: print('Primo!') elif n == 2: print('Primo!') else: print('Par!')
""" A selection of job objects used in testing. """ EMPTY_JOB = '''\ <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description></description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers class="vector"/> <concurrentBuild>false</concurrentBuild> <builders/> <publishers/> <buildWrappers/> </project> '''.strip() LONG_RUNNING_JOB = """ <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description></description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers class="vector"/> <concurrentBuild>false</concurrentBuild> <builders> <hudson.tasks.Shell> <command>ping -c 200 localhost</command> </hudson.tasks.Shell> </builders> <publishers/> <buildWrappers/> </project>""".strip() SHORTISH_JOB = """ <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description></description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers class="vector"/> <concurrentBuild>false</concurrentBuild> <builders> <hudson.tasks.Shell> <command>ping -c 10 localhost</command> </hudson.tasks.Shell> </builders> <publishers/> <buildWrappers/> </project>""".strip() SCM_GIT_JOB = """ <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description></description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.plugins.git.GitSCM"> <configVersion>2</configVersion> <userRemoteConfigs> <hudson.plugins.git.UserRemoteConfig> <name></name> <refspec></refspec> <url>https://github.com/salimfadhley/jenkinsapi.git</url> </hudson.plugins.git.UserRemoteConfig> </userRemoteConfigs> <branches> <hudson.plugins.git.BranchSpec> <name>**</name> </hudson.plugins.git.BranchSpec> </branches> <disableSubmodules>false</disableSubmodules> <recursiveSubmodules>false</recursiveSubmodules> <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations> <authorOrCommitter>false</authorOrCommitter> <clean>false</clean> <wipeOutWorkspace>false</wipeOutWorkspace> <pruneBranches>false</pruneBranches> <remotePoll>false</remotePoll> <ignoreNotifyCommit>false</ignoreNotifyCommit> <useShallowClone>false</useShallowClone> <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/> <gitTool>Default</gitTool> <submoduleCfg class="list"/> <relativeTargetDir></relativeTargetDir> <reference></reference> <excludedRegions></excludedRegions> <excludedUsers></excludedUsers> <gitConfigName></gitConfigName> <gitConfigEmail></gitConfigEmail> <skipTag>true</skipTag> <includedRegions></includedRegions> <scmName></scmName> </scm> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers class="vector"/> <concurrentBuild>false</concurrentBuild> <builders/> <publishers/> <buildWrappers/> </project>""".strip() JOB_WITH_ARTIFACTS = """ <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description>Ping a load of stuff for about 10s</description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers class="vector"/> <concurrentBuild>false</concurrentBuild> <builders> <hudson.tasks.Shell> <command>ping -c 5 localhost | tee out.txt gzip &lt; out.txt &gt; out.gz</command> </hudson.tasks.Shell> </builders> <publishers> <hudson.tasks.ArtifactArchiver> <artifacts>*.txt,*.gz</artifacts> <latestOnly>false</latestOnly> </hudson.tasks.ArtifactArchiver> <hudson.tasks.Fingerprinter> <targets></targets> <recordBuildArtifacts>true</recordBuildArtifacts> </hudson.tasks.Fingerprinter> </publishers> <buildWrappers/> </project>""".strip() MATRIX_JOB = """ <?xml version='1.0' encoding='UTF-8'?> <matrix-project> <actions/> <description></description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers class="vector"/> <concurrentBuild>false</concurrentBuild> <axes> <hudson.matrix.TextAxis> <name>foo</name> <values> <string>one</string> <string>two</string> <string>three</string> </values> </hudson.matrix.TextAxis> </axes> <builders> <hudson.tasks.Shell> <command>ping -c 10 localhost</command> </hudson.tasks.Shell> </builders> <publishers/> <buildWrappers/> </matrix-project>""".strip()
# Comma Code # Say you have a list value like this: # spam = ['apples', 'bananas', 'tofu', 'cats'] # Write a function that takes a list value as an argument and returns a string wit # h all the items separated by a comma and a space, with and inserted before the l # ast item. For example, passing the previous spam list to the function would retu # rn 'apples, bananas, tofu, and cats'. But your function should be able to work w # ith any list value passed to it. Be sure to test the case where an empty list [] # is passed to your function. spam = ['apples', 'bananas', 'tofu', 'cats'] def comma_code(l): if (len(l) <= 0): return "" elif (len(l) == 1): return l[0] else: return ', '.join(l[:-1]) + " and " + l[-1] print(comma_code(spam))
a = [1, 0, 5, -2, -5, 7] soma = a[0] + a[1] + a[5] print(soma) a[4] = 100 print(a) for v in a: print(v)
sums_new_methodology = { "Total revenue": { "A01", "A03", "A09", "A10", "A12", "A16", "A18", "A21", "A36", "A44", "A45", "A50", "A54", "A56", "A59", "A60", "A61", "A80", "A81", "A87", "A89", "A90", "A91", "A92", "A93", "A94", "B01", "B21", "B22", "B30", "B42", "B43", "B46", "B50", "B54", "B59", "B79", "B80", "B89", "B91", "B92", "B93", "B94", "D21", "D30", "D42", "D46", "D50", "D79", "D80", "D89", "D91", "D92", "D93", "D94", "T01", "T09", "T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19", "T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29", "T40", "T41", "T50", "T51", "T53", "T99", "U01", "U11", "U20", "U21", "U30", "U40", "U41", "U50", "U95", "U99", "X01", "X02", "X05", "X08", "Y01", "Y02", "Y04", "Y11", "Y12", "Y51", "Y52", }, "General revenue": { "A01", "A03", "A09", "A10", "A12", "A16", "A18", "A21", "A36", "A44", "A45", "A50", "A54", "A56", "A59", "A60", "A61", "A80", "A81", "A87", "A89", "B01", "B21", "B22", "B30", "B42", "B43", "B46", "B50", "B54", "B59", "B79", "B80", "B89", "B91", "B92", "B93", "B94", "D21", "D30", "D42", "D46", "D50", "D79", "D80", "D89", "D91", "D92", "D93", "D94", "T01", "T09", "T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19", "T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29", "T40", "T41", "T50", "T51", "T53", "T99", "U01", "U11", "U20", "U21", "U30", "U40", "U41", "U50", "U95", "U99", }, "Intergovernmental revenue": { "B01", "B21", "B22", "B30", "B42", "B43", "B46", "B50", "B54", "B59", "B79", "B80", "B89", "B91", "B92", "B93", "B94", "D21", "D30", "D42", "D46", "D50", "D79", "D80", "D89", "D91", "D92", "D93", "D94", }, "Taxes": { "T01", "T09", "T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19", "T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29", "T40", "T41", "T50", "T51", "T53", "T99", }, "General sales": {"T09"}, "Selective sales": {"T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19"}, "License taxes": {"T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29"}, "Individual income tax": {"T40"}, "Corporate income tax": {"T41"}, "Other taxes": {"T01", "T50", "T51", "T53", "T99"}, "Current charge": { "A01", "A03", "A09", "A10", "A12", "A16", "A18", "A21", "A36", "A44", "A45", "A50", "A54", "A56", "A59", "A60", "A61", "A80", "A81", "A87", "A89", }, "Miscellaneous general revenue": { "U01", "U11", "U20", "U21", "U30", "U40", "U41", "U50", "U95", "U99", }, "Utility revenue": {"A91", "A92", "A93", "A94"}, "Liquor stores revenue": {"A90"}, "Insurance trust revenue": { "X01", "X02", "X05", "X08", "Y01", "Y02", "Y04", "Y11", "Y12", "Y50", "Y51", "Y52", }, "Total expenditure": { "E01", "E03", "E04", "E05", "E12", "E16", "E18", "E21", "E22", "E23", "E25", "E26", "E27", "E29", "E31", "E32", "E36", "E44", "E45", "E50", "E52", "E54", "E55", "E56", "E59", "E60", "E61", "E62", "E66", "E74", "E75", "E77", "E79", "E80", "E81", "E85", "E87", "E89", "E90", "E91", "E92", "E93", "E94", "F01", "F03", "F04", "F05", "F12", "F16", "F18", "F21", "F22", "F23", "F25", "F26", "F27", "F29", "F31", "F32", "F36", "F44", "F45", "F50", "F52", "F54", "F55", "F56", "F59", "F60", "F61", "F62", "F66", "F77", "F79", "F80", "F81", "F85", "F87", "F89", "F90", "F91", "F92", "F93", "F94", "G01", "G03", "G04", "G05", "G12", "G16", "G18", "G21", "G22", "G23", "G25", "G26", "G27", "G29", "G31", "G32", "G36", "G44", "G45", "G50", "G52", "G54", "G55", "G56", "G59", "G60", "G61", "G62", "G66", "G77", "G79", "G80", "G81", "G85", "G87", "G89", "G90", "G91", "G92", "G93", "G94", "I89", "I91", "I92", "I93", "I94", "J19", "J67", "J68", "J85", "M01", "M04", "M05", "M12", "M18", "M21", "M23", "M25", "M27", "M29", "M30", "M32", "M36", "M44", "M50", "M52", "M54", "M55", "M56", "M59", "M60", "M61", "M62", "M66", "M67", "M68", "M79", "M80", "M81", "M87", "M89", "M91", "M92", "M93", "M94", "Q12", "Q18", "S67", "S89", "X11", "X12", "Y05", "Y06", "Y14", "Y53", }, "Intergovernmental expenditure": { "M01", "M04", "M05", "M12", "M18", "M21", "M23", "M25", "M27", "M29", "M30", "M32", "M36", "M44", "M50", "M52", "M54", "M55", "M56", "M59", "M60", "M61", "M62", "M66", "M67", "M68", "M79", "M80", "M81", "M87", "M89", "M91", "M92", "M93", "M94", "Q12", "Q18", "S67", "S89", }, "Direct expenditure": { "E01", "E03", "E04", "E05", "E12", "E16", "E18", "E21", "E22", "E23", "E25", "E26", "E27", "E29", "E31", "E32", "E36", "E44", "E45", "E50", "E52", "E54", "E55", "E56", "E59", "E60", "E61", "E62", "E66", "E74", "E75", "E77", "E79", "E80", "E81", "E85", "E87", "E89", "E90", "E91", "E92", "E93", "E94", "F01", "F03", "F04", "F05", "F12", "F16", "F18", "F21", "F22", "F23", "F25", "F26", "F27", "F29", "F31", "F32", "F36", "F44", "F45", "F50", "F52", "F54", "F55", "F56", "F59", "F60", "F61", "F62", "F66", "F77", "F79", "F80", "F81", "F85", "F87", "F89", "F90", "F91", "F92", "F93", "F94", "G01", "G03", "G04", "G05", "G12", "G16", "G18", "G21", "G22", "G23", "G25", "G26", "G27", "G29", "G31", "G32", "G36", "G44", "G45", "G50", "G52", "G54", "G55", "G56", "G59", "G60", "G61", "G62", "G66", "G77", "G79", "G80", "G81", "G85", "G87", "G89", "G90", "G91", "G92", "G93", "G94", "I89", "I91", "I92", "I93", "I94", "J19", "J67", "J68", "J85", "X11", "X12", "Y05", "Y06", "Y14", "Y53", }, "Current operation": { "E01", "E03", "E04", "E05", "E12", "E16", "E18", "E21", "E22", "E23", "E25", "E26", "E27", "E29", "E31", "E32", "E36", "E44", "E45", "E50", "E52", "E54", "E55", "E56", "E59", "E60", "E61", "E62", "E66", "E74", "E75", "E77", "E79", "E80", "E81", "E85", "E87", "E89", "E90", "E91", "E92", "E93", "E94", }, "Capital outlay": { "F01", "F03", "F04", "F05", "F12", "F16", "F18", "F21", "F22", "F23", "F25", "F26", "F27", "F29", "F31", "F32", "F36", "F44", "F45", "F50", "F52", "F54", "F55", "F56", "F59", "F60", "F61", "F62", "F66", "F77", "F79", "F80", "F81", "F85", "F87", "F89", "F90", "F91", "F92", "F93", "F94", "G01", "G03", "G04", "G05", "G12", "G16", "G18", "G21", "G22", "G23", "G25", "G26", "G27", "G29", "G31", "G32", "G36", "G44", "G45", "G50", "G52", "G54", "G55", "G56", "G59", "G60", "G61", "G62", "G66", "G77", "G79", "G80", "G81", "G85", "G87", "G89", "G90", "G91", "G92", "G93", "G94", }, "Insurance benefits and repayments": {"X11", "X12", "Y05", "Y06", "Y14", "Y53",}, "Assistance and subsidies": {"J19", "J67", "J68", "J85"}, "Interest on debt": {"I89", "I91", "I92", "I93", "I94"}, "Exhibit: Salaries and wages": {"Z00"}, "General expenditure": { "E01", "E03", "E04", "E05", "E12", "E16", "E18", "E21", "E22", "E23", "E25", "E26", "E27", "E29", "E31", "E32", "E36", "E44", "E45", "E50", "E52", "E54", "E55", "E56", "E59", "E60", "E61", "E62", "E66", "E74", "E75", "E77", "E79", "E80", "E81", "E85", "E87", "E89", "F01", "F03", "F04", "F05", "F12", "F16", "F18", "F21", "F22", "F23", "F25", "F26", "F27", "F29", "F31", "F32", "F36", "F44", "F45", "F50", "F52", "F54", "F55", "F56", "F59", "F60", "F61", "F62", "F66", "F77", "F79", "F80", "F81", "F85", "F87", "F89", "G01", "G03", "G04", "G05", "G12", "G16", "G18", "G21", "G22", "G23", "G25", "G26", "G27", "G29", "G31", "G32", "G36", "G44", "G45", "G50", "G52", "G54", "G55", "G56", "G59", "G60", "G61", "G62", "G66", "G77", "G79", "G80", "G81", "G85", "G87", "G89", "I89", "J19", "J67", "J68", "J85", "M01", "M04", "M05", "M12", "M18", "M21", "M23", "M25", "M27", "M29", "M30", "M32", "M36", "M44", "M50", "M52", "M54", "M55", "M56", "M59", "M60", "M61", "M62", "M66", "M67", "M68", "M79", "M80", "M81", "M87", "M89", "M91", "M92", "M93", "M94", "Q12", "Q18", "S67", "S89", }, "Direct general expenditure": { "E01", "E03", "E04", "E05", "E12", "E16", "E18", "E21", "E22", "E23", "E25", "E26", "E27", "E29", "E31", "E32", "E36", "E44", "E45", "E50", "E52", "E54", "E55", "E56", "E59", "E60", "E61", "E62", "E66", "E74", "E75", "E77", "E79", "E80", "E81", "E85", "E87", "E89", "F01", "F03", "F04", "F05", "F12", "F16", "F18", "F21", "F22", "F23", "F25", "F26", "F27", "F29", "F31", "F32", "F36", "F44", "F45", "F50", "F52", "F54", "F55", "F56", "F59", "F60", "F61", "F62", "F66", "F77", "F79", "F80", "F81", "F85", "F87", "F89", "G01", "G03", "G04", "G05", "G12", "G16", "G18", "G21", "G22", "G23", "G25", "G26", "G27", "G29", "G31", "G32", "G36", "G44", "G45", "G50", "G52", "G54", "G55", "G56", "G59", "G60", "G61", "G62", "G66", "G77", "G79", "G80", "G81", "G85", "G87", "G89", "I89", "J19", "J67", "J68", "J85", }, "Education": { "E12", "E16", "E18", "E21", "F12", "F16", "F18", "F21", "G12", "G16", "G18", "G21", "J19", "M12", "M18", "M21", "Q12", "Q18", }, "Public welfare": { "E74", "E75", "E77", "E79", "F77", "F79", "G77", "G79", "J67", "J68", "M67", "M68", "M79", "S67", }, "Hospitals": {"E36", "F36", "G36", "M36"}, "Health": {"E32", "F32", "G32", "M32"}, "Highways": {"E44", "M44", "F44", "G44", "E45", "F45", "G45"}, "Police protection": {"E62", "F62", "G62", "M62"}, "Correction": {"E04", "E05", "F04", "F05", "G04", "G05", "M04", "M05",}, "Natural resources": { "E54", "E55", "E56", "E59", "F54", "F55", "F56", "F59", "G54", "G55", "G56", "G59", "M54", "M55", "M56", "M59", }, "Parks and recreation": {"E61", "F61", "G61", "M61"}, "Governmental administration": { "E23", "E25", "E26", "E29", "E31", "F23", "F25", "F26", "F29", "F31", "G23", "G25", "G26", "G29", "G31", "M23", "M25", "M29", }, "Interest on general debt": {"I89"}, "Other and unallocable": { "E01", "E03", "E22", "E50", "E52", "E60", "E66", "E80", "E81", "E85", "E87", "E89", "F01", "F03", "F22", "F50", "F52", "F60", "F66", "F80", "F81", "F85", "F87", "F89", "G01", "G03", "G22", "G50", "G52", "G60", "G66", "G80", "G81", "G85", "G87", "G89", "M01", "M50", "M52", "M60", "M66", "M80", "M81", "M87", "M89", "S89", }, "Utility expenditure": { "E91", "E92", "E93", "E94", "F91", "F92", "F93", "F94", "G91", "G92", "G93", "G94", "I91", "I92", "I93", "I94", "M91", "M92", "M93", "M94", }, "Liquor stores expenditure": {"E90", "F90", "G90"}, "Insurance trust expenditure": {"X11", "X12", "Y05", "Y06", "Y14", "Y53",}, "Debt at end of fiscal year": {"64V", "44T", "49U"}, "Cash and security holdings": { "W01", "W31", "W61", "X21", "X30", "X42", "X44", "X47", "Y07", "Y08", "Y21", "Y61", "Z77", "Z78", }, } # sums_1992_2004 = { # "Total revenue": { # "T01", # "T08", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T50", # "T51", # "T53", # "T99", # "A01", # "A03", # "A06", # "A09", # "A10", # "A12", # "A14", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # "U01", # "U10", # "U11", # "U20", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # "B01", # "B21", # "B22", # "B27", # "B30", # "B42", # "B46", # "B47", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "B91", # "B92", # "B93", # "B94", # "C21", # "C28", # "C30", # "C42", # "C46", # "C47", # "C50", # "C67", # "C79", # "C80", # "C89", # "C91", # "C92", # "C93", # "C94", # "D11", # "D21", # "D30", # "D42", # "D46", # "D47", # "D50", # "D79", # "D80", # "D89", # "D91", # "D92", # "D93", # "D94", # "A91", # "A92", # "A93", # "A94", # "A90", # "X01", # "X02", # "X05", # "X08", # "X09", # "X03", # "Y01", # "Y02", # "Y03", # "Y04", # "Y11", # "Y12", # "Y13", # "Y51", # "Y52", # "Y20", # "Y31", # "Y41", # "Y55", # }, # "General revenue": { # "T01", # "T08", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T50", # "T51", # "T53", # "T99", # "A01", # "A03", # "A06", # "A09", # "A10", # "A12", # "A14", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # "U01", # "U10", # "U11", # "U20", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # "B01", # "B21", # "B22", # "B27", # "B30", # "B42", # "B46", # "B47", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "B91", # "B92", # "B93", # "B94", # "C21", # "C28", # "C30", # "C42", # "C46", # "C47", # "C50", # "C67", # "C79", # "C80", # "C89", # "C91", # "C92", # "C93", # "C94", # "D11", # "D21", # "D30", # "D42", # "D46", # "D47", # "D50", # "D79", # "D80", # "D89", # "D91", # "D92", # "D93", # "D94", # }, # "Intergovernmental revenue": { # "B01", # "B21", # "B22", # "B27", # "B30", # "B42", # "B46", # "B47", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "B91", # "B92", # "B93", # "B94", # "C21", # "C28", # "C30", # "C42", # "C46", # "C47", # "C50", # "C67", # "C79", # "C80", # "C89", # "C91", # "C92", # "C93", # "C94", # "D11", # "D21", # "D30", # "D42", # "D46", # "D47", # "D50", # "D79", # "D80", # "D89", # "D91", # "D92", # "D93", # "D94", # }, # "Taxes": { # "T01", # "T08", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T50", # "T51", # "T53", # "T99", # }, # "General sales": {"T09",}, # "Selective sales": {"T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19"}, # "License taxes": {"T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29",}, # "Individual income tax": {"T40"}, # "Corporate income tax": {"T41"}, # "Other taxes": {"T01", "T50", "T51", "T53", "T99"}, # "Current charge": { # "A01", # "A03", # "A06", # "A09", # "A10", # "A12", # "A14", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # }, # "Miscellaneous general revenue": { # "U01", # "U10", # "U11", # "U20", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # }, # "Utility revenue": {"A91", "A92", "A93", "A94"}, # "Liquor stores revenue": {"A90"}, # "Insurance trust revenue": { # "X01", # "X02", # "X05", # "X08", # "Y01", # "Y02", # "Y04", # "Y10", # "Y11", # "Y12", # "Y50", # "Y51", # "Y52", # }, # "Total expenditure": { # "E01", # "F01", # "G01", # "I01", # "L01", # "M01", # "N01", # "O01", # "P01", # "R01", # "E02", # "F02", # "G02", # "I02", # "L02", # "M02", # "E03", # "F03", # "G03", # "E04", # "F04", # "G04", # "I04", # "L04", # "M04", # "E05", # "F05", # "G05", # "L05", # "M05", # "N05", # "O05", # "P05", # "S05", # "E06", # "F06", # "G06", # "I06", # "L06", # "M06", # "E12", # "F12", # "G12", # "L12", # "M12", # "N12", # "O12", # "P12", # "Q12", # "R12", # "E14", # "F14", # "G14", # "I14", # "E16", # "F16", # "G16", # "E18", # "F18", # "G18", # "L18", # "M18", # "N18", # "O18", # "P18", # "Q18", # "R18", # "E19", # "E20", # "F20", # "G20", # "I20", # "L20", # "M20", # "E21", # "F21", # "G21", # "I21", # "L21", # "M21", # "N21", # "O21", # "P21", # "Q21", # "S21", # "E22", # "F22", # "G22", # "I22", # "L22", # "M22", # "E23", # "F23", # "G23", # "I23", # "L23", # "M23", # "N23", # "O23", # "P23", # "E24", # "F24", # "G24", # "L24", # "M24", # "N24", # "O24", # "P24", # "R24", # "E25", # "F25", # "G25", # "I25", # "L25", # "M25", # "N25", # "O25", # "P25", # "S25", # "E26", # "F26", # "G26", # "E28", # "F28", # "G28", # "I28", # "L28", # "M28", # "E29", # "F29", # "G29", # "I29", # "L29", # "M29", # "N29", # "O29", # "P29", # "M30", # "N30", # "O30", # "P30", # "R30", # "E31", # "F31", # "G31", # "E32", # "F32", # "G32", # "I32", # "L32", # "M32", # "N32", # "O32", # "P32", # "R32", # "E36", # "F36", # "G36", # "E37", # "F37", # "G37", # "I37", # "L37", # "M37", # "E38", # "F38", # "G38", # "I38", # "L38", # "M38", # "N38", # "O38", # "P38", # "R38", # "E39", # "F39", # "G39", # "I39", # "L39", # "M39", # "E44", # "F44", # "G44", # "I44", # "L44", # "M44", # "N44", # "O44", # "P44", # "R44", # "E45", # "F45", # "G45", # "E47", # "I47", # "L47", # "M47", # "N47", # "O47", # "P47", # "R47", # "E50", # "F50", # "G50", # "I50", # "L50", # "M50", # "N50", # "O50", # "P50", # "R50", # "E51", # "I51", # "L51", # "M51", # "E52", # "F52", # "G52", # "I52", # "L52", # "M52", # "N52", # "O52", # "P52", # "R52", # "E53", # "F53", # "G53", # "I53", # "L53", # "M53", # "E54", # "F54", # "G54", # "I54", # "L54", # "M54", # "N54", # "O54", # "P54", # "R54", # "E55", # "F55", # "G55", # "M55", # "N55", # "O55", # "P55", # "R55", # "E56", # "F56", # "G56", # "I56", # "L56", # "M56", # "N56", # "O56", # "P56", # "R56", # "E57", # "F57", # "G57", # "I57", # "L57", # "M57", # "E58", # "F58", # "G58", # "I58", # "L58", # "M58", # "E59", # "F59", # "G59", # "I59", # "L59", # "M59", # "N59", # "O59", # "P59", # "R59", # "S59", # "E60", # "F60", # "G60", # "I60", # "L60", # "M60", # "N60", # "O60", # "P60", # "R60", # "E61", # "F61", # "G61", # "I61", # "L61", # "M61", # "N61", # "O61", # "P61", # "R61", # "E62", # "F62", # "G62", # "I62", # "L62", # "M62", # "N62", # "O62", # "P62", # "R62", # "E66", # "F66", # "G66", # "I66", # "L66", # "M66", # "N66", # "O66", # "P66", # "R66", # "E67", # "I67", # "L67", # "M67", # "N67", # "O67", # "P67", # "S67", # "E68", # "I68", # "M68", # "N68", # "O68", # "P68", # "E74", # "E75", # "E77", # "F77", # "G77", # "E79", # "G79", # "F79", # "I79", # "L79", # "M79", # "N79", # "O79", # "P79", # "R79", # "E80", # "F80", # "G80", # "I80", # "L80", # "M80", # "N80", # "O80", # "P80", # "R80", # "E81", # "F81", # "G81", # "I81", # "L81", # "M81", # "N81", # "O81", # "P81", # "R81", # "E84", # "E85", # "F85", # "G85", # "I85", # "E87", # "F87", # "G87", # "I87", # "L87", # "M87", # "N87", # "O87", # "P87", # "R87", # "E89", # "F89", # "G89", # "I89", # "J89", # "L89", # "M89", # "N89", # "O89", # "P89", # "R89", # "S89", # "E90", # "F90", # "G90", # "E91", # "F91", # "G91", # "I91", # "E92", # "F92", # "G92", # "I92", # "E93", # "F93", # "G93", # "I93", # "E94", # "F94", # "G94", # "I94", # "L91", # "L92", # "L93", # "L94", # "M91", # "M92", # "M93", # "M94", # "N91", # "N92", # "N93", # "N94", # "R91", # "R92", # "R93", # "R94", # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y53", # "Y25", # "Y34", # "Y45", # }, # "Intergovernmental expenditure": { # "L01", # "M01", # "N01", # "O01", # "P01", # "R01", # "L02", # "M02", # "L04", # "M04", # "L05", # "M05", # "N05", # "O05", # "P05", # "S05", # "L06", # "M06", # "L12", # "M12", # "N12", # "O12", # "P12", # "Q12", # "R12", # "L18", # "M18", # "N18", # "O18", # "P18", # "Q18", # "R18", # "L20", # "M20", # "L21", # "M21", # "N21", # "O21", # "P21", # "Q21", # "S21", # "L22", # "M22", # "L23", # "M23", # "N23", # "O23", # "P23", # "L24", # "M24", # "N24", # "O24", # "P24", # "R24", # "L25", # "M25", # "N25", # "O25", # "P25", # "S25", # "L28", # "M28", # "L29", # "M29", # "N29", # "O29", # "P29", # "M30", # "N30", # "O30", # "P30", # "R30", # "L32", # "M32", # "N32", # "O32", # "P32", # "R32", # "L37", # "M37", # "L38", # "M38", # "N38", # "O38", # "P38", # "R38", # "L39", # "M39", # "L44", # "M44", # "N44", # "O44", # "P44", # "R44", # "L47", # "M47", # "N47", # "O47", # "P47", # "R47", # "L50", # "M50", # "N50", # "O50", # "P50", # "R50", # "L51", # "M51", # "L52", # "M52", # "N52", # "O52", # "P52", # "R52", # "L53", # "M53", # "L54", # "M54", # "N54", # "O54", # "P54", # "R54", # "M55", # "N55", # "O55", # "P55", # "R55", # "L56", # "M56", # "N56", # "O56", # "P56", # "R56", # "L57", # "M57", # "L58", # "M58", # "L59", # "M59", # "N59", # "O59", # "P59", # "R59", # "S59", # "L60", # "M60", # "N60", # "O60", # "P60", # "R60", # "L61", # "M61", # "N61", # "O61", # "P61", # "R61", # "L62", # "M62", # "N62", # "O62", # "P62", # "R62", # "L66", # "M66", # "N66", # "O66", # "P66", # "R66", # "L67", # "M67", # "N67", # "O67", # "P67", # "S67", # "M68", # "N68", # "O68", # "P68", # "L79", # "M79", # "N79", # "O79", # "P79", # "R79", # "L80", # "M80", # "N80", # "O80", # "P80", # "R80", # "L81", # "M81", # "N81", # "O81", # "P81", # "R81", # "L87", # "M87", # "N87", # "O87", # "P87", # "R87", # "L89", # "M89", # "N89", # "O89", # "P89", # "R89", # "S89", # "L91", # "L92", # "L93", # "L94", # "M91", # "M92", # "M93", # "M94", # "N91", # "N92", # "N93", # "N94", # "R91", # "R92", # "R93", # "R94", # }, # "Direct expenditure": { # "E01", # "G01", # "F01", # "I01", # "I02", # "E02", # "G02", # "F02", # "E03", # "F03", # "G03", # "E04", # "F04", # "G04", # "I04", # "E05", # "F05", # "G05", # "E06", # "F06", # "G06", # "I06", # "E12", # "F12", # "G12", # "E14", # "F14", # "G14", # "I14", # "E16", # "F16", # "G16", # "E18", # "F18", # "G18", # "E19", # "E20", # "F20", # "G20", # "I20", # "E21", # "F21", # "G21", # "I21", # "E22", # "F22", # "G22", # "I22", # "E23", # "F23", # "G23", # "I23", # "E24", # "F24", # "G24", # "E25", # "F25", # "G25", # "I25", # "E26", # "F26", # "G26", # "E28", # "F28", # "G28", # "I28", # "E29", # "F29", # "G29", # "I29", # "E31", # "F31", # "G31", # "E32", # "F32", # "G32", # "I32", # "E36", # "F36", # "G36", # "E37", # "F37", # "G37", # "I37", # "E38", # "F38", # "G38", # "I38", # "E39", # "F39", # "G39", # "I39", # "E44", # "F44", # "G44", # "I44", # "E45", # "F45", # "G45", # "E47", # "I47", # "E50", # "F50", # "G50", # "I50", # "E51", # "I51", # "E52", # "F52", # "G52", # "I52", # "E53", # "F53", # "G53", # "I53", # "E54", # "F54", # "G54", # "I54", # "E55", # "F55", # "G55", # "E56", # "F56", # "G56", # "I56", # "E57", # "F57", # "G57", # "I57", # "E58", # "F58", # "G58", # "I58", # "E59", # "F59", # "G59", # "I59", # "E60", # "F60", # "G60", # "I60", # "E61", # "F61", # "G61", # "I61", # "E62", # "F62", # "G62", # "I62", # "E66", # "F66", # "G66", # "I66", # "E67", # "I67", # "E68", # "I68", # "E74", # "E75", # "E77", # "F77", # "G77", # "E79", # "F79", # "G79", # "I79", # "E80", # "F80", # "G80", # "I80", # "E81", # "F81", # "G81", # "I81", # "E84", # "E85", # "F85", # "G85", # "I85", # "E87", # "F87", # "G87", # "I87", # "E89", # "F89", # "G89", # "I89", # "J89", # "E90", # "F90", # "G90", # "E91", # "F91", # "G91", # "I91", # "E92", # "F92", # "G92", # "I92", # "E93", # "F93", # "G93", # "I93", # "E94", # "F94", # "G94", # "I94", # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y53", # "Y25", # "Y34", # "Y45", # }, # "Current operation": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "E90", # "E91", # "E92", # "E93", # "E94", # }, # "Capital outlay": { # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "F90", # "F91", # "F92", # "F93", # "F94", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "G90", # "G91", # "G92", # "G93", # "G94", # }, # "Insurance benefits and repayments": { # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y15", # "Y53", # "Y54", # }, # "Assistance and subsidies": { # "I01", # "I02", # "I04", # "I06", # "I14", # "E19", # "I20", # "I21", # "I22", # "I23", # "I25", # "I28", # "I29", # "I32", # "I37", # "I38", # "I39", # "I44", # "I47", # "I50", # "I51", # "I52", # "I53", # "I54", # "I56", # "I57", # "I58", # "I59", # "I60", # "I61", # "I62", # "I66", # "E67", # "I67", # "E68", # "I68", # "I79", # "I80", # "I81", # "E84", # "I85", # "I87", # "J89", # }, # "Interest on debt": {"I89", "I91", "I92", "I93", "I94"}, # "Exhibit: Salaries and wages": {"Z00"}, # "General expenditure": { # "E01", # "F01", # "G01", # "I01", # "L01", # "M01", # "N01", # "O01", # "P01", # "R01", # "E02", # "F02", # "G02", # "I02", # "L02", # "M02", # "E03", # "F03", # "G03", # "E04", # "F04", # "G04", # "I04", # "L04", # "M04", # "E05", # "F05", # "G05", # "L05", # "M05", # "N05", # "O05", # "P05", # "S05", # "E06", # "F06", # "G06", # "I06", # "L06", # "M06", # "E12", # "F12", # "G12", # "L12", # "M12", # "N12", # "O12", # "P12", # "Q12", # "R12", # "E14", # "F14", # "G14", # "I14", # "E16", # "F16", # "G16", # "E18", # "F18", # "G18", # "L18", # "M18", # "N18", # "O18", # "P18", # "Q18", # "R18", # "E19", # "E20", # "F20", # "G20", # "I20", # "L20", # "M20", # "E21", # "F21", # "G21", # "I21", # "L21", # "M21", # "N21", # "O21", # "P21", # "Q21", # "S21", # "E22", # "F22", # "G22", # "I22", # "L22", # "M22", # "E23", # "F23", # "G23", # "I23", # "L23", # "M23", # "N23", # "O23", # "P23", # "E24", # "F24", # "G24", # "L24", # "M24", # "N24", # "O24", # "P24", # "R24", # "E25", # "F25", # "G25", # "I25", # "L25", # "M25", # "N25", # "O25", # "P25", # "S25", # "E26", # "F26", # "G26", # "E28", # "F28", # "G28", # "I28", # "L28", # "M28", # "E29", # "F29", # "G29", # "I29", # "L29", # "M29", # "N29", # "O29", # "P29", # "M30", # "N30", # "O30", # "P30", # "R30", # "E31", # "F31", # "G31", # "E32", # "F32", # "G32", # "I32", # "L32", # "M32", # "N32", # "O32", # "P32", # "R32", # "E36", # "F36", # "G36", # "E37", # "F37", # "G37", # "I37", # "L37", # "M37", # "E38", # "F38", # "G38", # "I38", # "L38", # "M38", # "N38", # "O38", # "P38", # "R38", # "E39", # "F39", # "G39", # "I39", # "L39", # "M39", # "E44", # "F44", # "G44", # "I44", # "L44", # "M44", # "N44", # "O44", # "P44", # "R44", # "E45", # "F45", # "G45", # "E47", # "I47", # "L47", # "M47", # "N47", # "O47", # "P47", # "R47", # "E50", # "F50", # "G50", # "I50", # "L50", # "M50", # "N50", # "O50", # "P50", # "R50", # "E51", # "I51", # "L51", # "M51", # "E52", # "F52", # "G52", # "I52", # "L52", # "M52", # "N52", # "O52", # "P52", # "R52", # "E53", # "F53", # "G53", # "I53", # "L53", # "M53", # "E54", # "F54", # "G54", # "I54", # "L54", # "M54", # "N54", # "O54", # "P54", # "R54", # "E55", # "F55", # "G55", # "M55", # "N55", # "O55", # "P55", # "R55", # "E56", # "F56", # "G56", # "I56", # "L56", # "M56", # "N56", # "O56", # "P56", # "R56", # "E57", # "F57", # "G57", # "I57", # "L57", # "M57", # "E58", # "F58", # "G58", # "I58", # "L58", # "M58", # "E59", # "F59", # "G59", # "I59", # "L59", # "M59", # "N59", # "O59", # "P59", # "R59", # "S59", # "E60", # "F60", # "G60", # "I60", # "L60", # "M60", # "N60", # "O60", # "P60", # "R60", # "E61", # "F61", # "G61", # "I61", # "L61", # "M61", # "N61", # "O61", # "P61", # "R61", # "E62", # "F62", # "G62", # "I62", # "L62", # "M62", # "N62", # "O62", # "P62", # "R62", # "E66", # "F66", # "G66", # "I66", # "L66", # "M66", # "N66", # "O66", # "P66", # "R66", # "E67", # "I67", # "L67", # "M67", # "N67", # "O67", # "P67", # "S67", # "E68", # "I68", # "M68", # "N68", # "O68", # "P68", # "E74", # "E75", # "E77", # "F77", # "G77", # "E79", # "F79", # "G79", # "I79", # "L79", # "M79", # "N79", # "O79", # "P79", # "R79", # "E80", # "F80", # "G80", # "I80", # "L80", # "M80", # "N80", # "O80", # "P80", # "R80", # "E81", # "F81", # "G81", # "I81", # "L81", # "M81", # "N81", # "O81", # "P81", # "R81", # "E84", # "E85", # "F85", # "G85", # "I85", # "E87", # "F87", # "G87", # "I87", # "L87", # "M87", # "N87", # "O87", # "P87", # "R87", # "E89", # "F89", # "G89", # "I89", # "J89", # "L89", # "M89", # "N89", # "O89", # "P89", # "R89", # "S89", # "L91", # "M91", # "N91", # "R91", # "L92", # "M92", # "N92", # "R92", # "L93", # "M93", # "N93", # "R93", # "L94", # "M94", # "N94", # "R94", # }, # "Direct general expenditure": { # "E01", # "G01", # "F01", # "I01", # "I02", # "E02", # "G02", # "F02", # "E03", # "F03", # "G03", # "E04", # "F04", # "G04", # "I04", # "E05", # "F05", # "G05", # "E06", # "F06", # "G06", # "I06", # "E12", # "F12", # "G12", # "E14", # "F14", # "G14", # "I14", # "E16", # "F16", # "G16", # "E18", # "F18", # "G18", # "E19", # "E20", # "F20", # "G20", # "I20", # "E21", # "F21", # "G21", # "I21", # "E22", # "F22", # "G22", # "I22", # "E23", # "F23", # "G23", # "I23", # "E24", # "F24", # "G24", # "E25", # "F25", # "G25", # "I25", # "E26", # "F26", # "G26", # "E28", # "F28", # "G28", # "I28", # "E29", # "F29", # "G29", # "I29", # "E31", # "F31", # "G31", # "E32", # "F32", # "G32", # "I32", # "E36", # "F36", # "G36", # "E37", # "F37", # "G37", # "I37", # "E38", # "F38", # "G38", # "I38", # "E39", # "F39", # "G39", # "I39", # "E44", # "F44", # "G44", # "I44", # "E45", # "F45", # "G45", # "E47", # "I47", # "E50", # "F50", # "G50", # "I50", # "E51", # "I51", # "E52", # "F52", # "G52", # "I52", # "E53", # "F53", # "G53", # "I53", # "E54", # "F54", # "G54", # "I54", # "E55", # "F55", # "G55", # "E56", # "F56", # "G56", # "I56", # "E57", # "F57", # "G57", # "I57", # "E58", # "F58", # "G58", # "I58", # "E59", # "F59", # "G59", # "I59", # "E60", # "F60", # "G60", # "I60", # "E61", # "F61", # "G61", # "I61", # "E62", # "F62", # "G62", # "I62", # "E66", # "F66", # "G66", # "I66", # "E67", # "I67", # "E68", # "I68", # "E74", # "E75", # "E77", # "F77", # "G77", # "E79", # "F79", # "G79", # "I79", # "E80", # "F80", # "G80", # "I80", # "E81", # "F81", # "G81", # "I81", # "E84", # "E85", # "F85", # "G85", # "I85", # "E87", # "F87", # "G87", # "I87", # "E89", # "F89", # "G89", # "I89", # "J89", # }, # "Education": { # "E12", # "F12", # "G12", # "L12", # "M12", # "N12", # "O12", # "P12", # "Q12", # "R12", # "E16", # "F16", # "G16", # "E18", # "F18", # "G18", # "L18", # "M18", # "N18", # "O18", # "P18", # "Q18", # "R18", # "E19", # "E20", # "F20", # "G20", # "I20", # "L20", # "M20", # "E21", # "F21", # "G21", # "I21", # "L21", # "M21", # "N21", # "O21", # "P21", # "Q21", # "S21", # }, # "Public welfare": { # "E67", # "I67", # "L67", # "M67", # "N67", # "O67", # "P67", # "S67", # "E68", # "I68", # "M68", # "N68", # "O68", # "P68", # "E74", # "E75", # "E77", # "F77", # "G77", # "E79", # "F79", # "G79", # "I79", # "L79", # "M79", # "N79", # "O79", # "P79", # "R79", # }, # "Hospitals": { # "E36", # "F36", # "G36", # "E37", # "F37", # "G37", # "I37", # "L37", # "M37", # "E39", # "F39", # "G39", # "I39", # "L39", # "M39", # "E38", # "F38", # "G38", # "I38", # "L38", # "M38", # "N38", # "O38", # "P38", # "R38", # }, # "Health": {"E32", "F32", "G32", "I32", "L32", "M32", "N32", "O32", "P32", "R32",}, # "Highways": { # "E44", # "F44", # "G44", # "I44", # "L44", # "M44", # "N44", # "O44", # "P44", # "R44", # "E45", # "F45", # "G45", # }, # "Police protection": { # "E62", # "F62", # "G62", # "I62", # "L62", # "M62", # "N62", # "O62", # "P62", # "R62", # }, # "Correction": { # "E04", # "F04", # "G04", # "I04", # "L04", # "M04", # "E05", # "F05", # "G05", # "L05", # "M05", # "N05", # "O05", # "P05", # "S05", # }, # "Natural resources": { # "E51", # "I51", # "L51", # "M51", # "E53", # "F53", # "G53", # "I53", # "L53", # "M53", # "E54", # "F54", # "G54", # "I54", # "L54", # "M54", # "N54", # "O54", # "P54", # "R54", # "E55", # "F55", # "G55", # "M55", # "N55", # "O55", # "P55", # "R55", # "E56", # "F56", # "G56", # "I56", # "L56", # "M56", # "N56", # "O56", # "P56", # "R56", # "E57", # "F57", # "G57", # "I57", # "L57", # "M57", # "E58", # "F58", # "G58", # "I58", # "L58", # "M58", # "E59", # "F59", # "G59", # "I59", # "L59", # "M59", # "N59", # "O59", # "P59", # "R59", # "S59", # }, # "Parks and recreation": { # "E61", # "F61", # "G61", # "I61", # "L61", # "M61", # "N61", # "O61", # "P61", # "R61", # }, # "Governmental administration": { # "E23", # "F23", # "G23", # "M23", # "E25", # "F25", # "G25", # "M25", # "E26", # "F26", # "G26", # "E29", # "M29", # "F29", # "G29", # "E31", # "F31", # "G31", # }, # "Interest on general debt": {"I89", "I91", "I92", "I93", "I94"}, # # "Other and unallocable": {"A61", "B46", "E77", "G45", "T21", "T28", "U41"}, # "Other and unallocable": { # "E01", # "F01", # "G01", # "M01", # "E03", # "F03", # "G03", # "E22", # "F22", # "G22", # "M30", # "E50", # "F50", # "G50", # "M50", # "E52", # "F52", # "G52", # "M52", # "E66", # "F66", # "G66", # "M66", # "E80", # "F80", # "G80", # "M80", # "E81", # "F81", # "G81", # "M81", # "E85", # "F85", # "G85", # "J85", # "E87", # "F87", # "G87", # "M87", # "E89", # "F89", # "G89", # "M89", # "S89", # "M91", # "M92", # "M93", # "M94", # }, # "Utility expenditure": { # "E91", # "F91", # "G91", # "I91", # "E92", # "F92", # "G92", # "I92", # "E93", # "F93", # "G93", # "I93", # "E94", # "F94", # "G94", # "I94", # }, # "Liquor stores expenditure": {"E90", "F90", "G90"}, # "Insurance trust expenditure": { # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y15", # "Y53", # "Y54", # }, # "Debt at end of fiscal year": { # "41A", # "41B", # "41C", # "41D", # "41E", # "41F", # "41G", # "41H", # "41J", # "41K", # "41M", # "41N", # "41P", # "41S", # "41X", # "41V", # "41Y", # "42A", # "42B", # "42C", # "42D", # "42E", # "42F", # "42G", # "42H", # "42J", # "42K", # "42L", # "42M", # "42N", # "42P", # "42R", # "42S", # "42X", # "43A", # "43B", # "43C", # "43D", # "43E", # "43F", # "43G", # "43H", # "43J", # "43K", # "43L", # "43M", # "43N", # "43P", # "43R", # "43S", # "43X", # "44A", # "44B", # "44C", # "44D", # "44E", # "44F", # "44G", # "44H", # "44J", # "44K", # "44L", # "44M", # "44N", # "44P", # "44R", # "44S", # "44T", # "44W", # "44X", # }, # "Cash and security holdings": { # "W01", # "W31", # "W61", # "W24", # "W54", # "W84", # "W10", # "W40", # "W70", # "W15", # "W45", # "W75", # "W13", # "W43", # "W73", # "Y44", # "Y84", # "Y61", # "Y70", # "Y73", # "Y75", # "Y07", # "Y08", # "Y21", # "Y30", # "Y33", # "Y35", # "X21", # "X30", # "X40", # "X41", # "X42", # "X44", # "X47", # }, # } # # sums_methods_pdf = { # "Total revenue": { # "B01", # "B21", # "B22", # "B30", # "B42", # "B43", # "B46", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "B91", # "B92", # "B93", # "B94", # "D21", # "D30", # "D42", # "D46", # "D50", # "D79", # "D80", # "D89", # "D91", # "D92", # "D93", # "D94", # "T01", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T50", # "T51", # "T53", # "T99", # "A01", # "A03", # "A09", # "A10", # "A12", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # "U01", # "U11", # "U20", # "U21", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # "A90", # "A91", # "A92", # "A93", # "A94", # "X01", # "X02", # "X05", # "X08", # "Y01", # "Y02", # "Y04", # "Y10", # "Y11", # "Y12", # "Y50", # "Y51", # "Y52", # }, # "General revenue": { # "B01", # "B21", # "B22", # "B30", # "B42", # "B43", # "B46", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "D21", # "D30", # "D42", # "D46", # "D50", # "D79", # "D80", # "D89", # "D94", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T01", # "T50", # "T51", # "T53", # "T99", # "A01", # "A03", # "A09", # "A10", # "A12", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # "U01", # "U11", # "U20", # "U21", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # }, # "Intergovernmental revenue": { # "B01", # "B21", # "B22", # "B30", # "B42", # "B43", # "B46", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "B91", # "B92", # "B93", # "B94", # "D21", # "D30", # "D42", # "D46", # "D50", # "D79", # "D80", # "D89", # "D91", # "D92", # "D93", # "D94", # "S74", # }, # "Taxes": { # "T01", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T50", # "T51", # "T53", # "T99", # }, # "General sales": {"T09"}, # "Selective sales": {"T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19"}, # "License taxes": {"T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29"}, # "Individual income tax": {"T40"}, # "Corporate income tax": {"T41"}, # "Other taxes": {"T01", "T50", "T51", "T53", "T99"}, # "Current charge": { # "A01", # "A03", # "A09", # "A10", # "A12", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # }, # "Miscellaneous general revenue": { # "U01", # "U11", # "U20", # "U21", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # }, # "Utility revenue": {"A91", "A92", "A93", "A94"}, # "Liquor stores revenue": {"A90"}, # "Insurance trust revenue": { # "X01", # "X02", # "X05", # "X08", # "Y01", # "Y02", # "Y04", # "Y10", # "Y11", # "Y12", # "Y50", # "Y51", # "Y52", # }, # "Total expenditure": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "E90", # "E91", # "E92", # "E93", # "E94", # "I89", # "I91", # "I92", # "I93", # "I94", # "J19", # "J67", # "J68", # "J85", # "X11", # "X12", # "Y05", # "Y06", # "Y15", # "Y14", # "Y53", # "Y54", # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "F90", # "F91", # "F92", # "F93", # "F94", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "G90", # "G91", # "G92", # "G93", # "G94", # "M01", # "M04", # "M05", # "M12", # "M18", # "M21", # "M23", # "M25", # "M27", # "M29", # "M30", # "M32", # "M36", # "M44", # "M50", # "M52", # "M54", # "M55", # "M56", # "M59", # "M60", # "M61", # "M62", # "M66", # "M67", # "M68", # "M79", # "M80", # "M81", # "M87", # "M89", # "M91", # "M92", # "M93", # "M94", # "Q12", # "Q18", # "S67", # "S74", # "S89", # }, # "Intergovernmental expenditure": { # "M01", # "M04", # "M05", # "M12", # "M18", # "M21", # "M23", # "M25", # "M27", # "M29", # "M30", # "M32", # "M36", # "M44", # "M50", # "M52", # "M54", # "M55", # "M56", # "M59", # "M60", # "M61", # "M62", # "M66", # "M67", # "M68", # "M79", # "M80", # "M81", # "M87", # "M89", # "M91", # "M92", # "M93", # "M94", # "Q12", # "Q18", # "S67", # "S68", # "S89", # }, # "Direct expenditure": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "E90", # "E91", # "E92", # "E93", # "E94", # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "F90", # "F91", # "F92", # "F93", # "F94", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "G90", # "G91", # "G92", # "G93", # "G94", # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y15", # "Y53", # "Y54", # "J19", # "J67", # "J68", # "J85", # "I89", # "I91", # "I92", # "I93", # "I94", # }, # "Current operation": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "E90", # "E91", # "E92", # "E93", # "E94", # }, # "Capital outlay": { # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "F90", # "F91", # "F92", # "F93", # "F94", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "G90", # "G91", # "G92", # "G93", # "G94", # }, # "Insurance benefits and repayments": { # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y15", # "Y53", # "Y54", # }, # "Assistance and subsidies": {"J19", "J67", "J68", "J85"}, # "Interest on debt": {"I89", "I91", "I92", "I93", "I94"}, # "Exhibit: Salaries and wages": {"Z00"}, # "General expenditure": { # "M01", # "M04", # "M05", # "M12", # "M18", # "M21", # "M23", # "M25", # "M27", # "M29", # "M30", # "M32", # "M36", # "M44", # "M50", # "M52", # "M54", # "M55", # "M56", # "M59", # "M60", # "M61", # "M62", # "M66", # "M67", # "M68", # "M79", # "M80", # "M81", # "M87", # "M89", # "M91", # "M92", # "M93", # "M94", # "Q12", # "Q18", # "S67", # "S89", # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "I89", # "J19", # "J67", # "J68", # "J85", # }, # "Direct general expenditure": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "I89", # "J19", # "J67", # "J68", # "J85", # }, # "Education": { # "E12", # "F12", # "G12", # "M12", # "Q12", # "E16", # "F16", # "G16", # "E18", # "F18", # "G18", # "M18", # "Q18", # "J19", # "E21", # "F21", # "G21", # "M21", # }, # "Public welfare": { # "J67", # "M67", # "S67", # "S74", # "J68", # "M68", # "E73", # "E74", # "E75", # "E77", # "F77", # "G77", # "E79", # "M79", # "F79", # "G79", # }, # "Hospitals": {"E36", "F36", "G36", "M36"}, # # "Health": {"E27", "E32", "F27", "F32", "G27", "G32", "M27", "M32"}, # "Health": {"E32", "F32", "G32", "M32"}, # "Highways": {"E44", "M44", "F44", "G44", "E45", "F45", "G45"}, # "Police protection": {"E62", "F62", "G62", "M62"}, # "Correction": {"E04", "M04", "F04", "G04", "E05", "F05", "G05", "M05"}, # "Natural resources": { # "E54", # "E55", # "M54", # "M55", # "E56", # "M56", # "E59", # "M59", # "F54", # "F55", # "F56", # "F59", # "G54", # "G55", # "G56", # "G59", # }, # "Parks and recreation": {"E61", "F61", "G61", "M61"}, # "Governmental administration": { # "E23", # "F23", # "G23", # "M23", # "E25", # "F25", # "G25", # "M25", # "E26", # "F26", # "G26", # "E29", # "M29", # "F29", # "G29", # "E31", # "F31", # "G31", # }, # "Interest on general debt": {"I89"}, # "Other and unallocable": { # "E01", # "F01", # "G01", # "M01", # "E03", # "F03", # "G03", # "E22", # "F22", # "G22", # "M30", # "E50", # "F50", # "G50", # "M50", # "E52", # "F52", # "G52", # "M52", # "E66", # "F66", # "G66", # "M66", # "E80", # "F80", # "G80", # "M80", # "E81", # "F81", # "G81", # "M81", # "E85", # "F85", # "G85", # "J85", # "E87", # "F87", # "G87", # "M87", # "E89", # "F89", # "G89", # "M89", # "S89", # "M91", # "M92", # "M93", # "M94", # }, # "Utility expenditure": { # "E91", # "F91", # "G91", # "I91", # "E92", # "F92", # "G92", # "I92", # "E93", # "F93", # "G93", # "I93", # "E94", # "F94", # "G94", # "I94", # }, # "Liquor stores expenditure": {"E90", "F90", "G90"}, # "Insurance trust expenditure": { # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y15", # "Y53", # "Y54", # }, # "Debt at end of fiscal year": {"64V", "44T", "49U"}, # "Cash and security holdings": { # "W01", # "W31", # "W61", # "X21", # "X30", # "Z77", # "Z78", # "X42", # "X44", # "X47", # "Y07", # "Y08", # "Y21", # "Y61", # }, # } # # sums_2005_2011 = { # "Total revenue": { # "B01", # "B21", # "B22", # "B30", # "B42", # "B43", # "B46", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "B91", # "B92", # "B93", # "B94", # "D21", # "D30", # "D42", # "D46", # "D50", # "D79", # "D80", # "D89", # "D91", # "D92", # "D93", # "D94", # "T01", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T50", # "T51", # "T53", # "T99", # "A01", # "A03", # "A09", # "A10", # "A12", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # "U01", # "U11", # "U20", # "U21", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # "A90", # "A91", # "A92", # "A93", # "A94", # "X01", # "X02", # "X05", # "X08", # "Y01", # "Y02", # "Y04", # "Y10", # "Y11", # "Y12", # "Y50", # "Y51", # "Y52", # }, # "General revenue": { # "B01", # "B21", # "B22", # "B30", # "B42", # "B43", # "B46", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "D21", # "D30", # "D42", # "D46", # "D50", # "D79", # "D80", # "D89", # "D94", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T01", # "T50", # "T51", # "T53", # "T99", # "A01", # "A03", # "A09", # "A10", # "A12", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # "U01", # "U11", # "U20", # "U21", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # }, # "Intergovernmental revenue": { # "B01", # "B21", # "B22", # "B30", # "B42", # "B43", # "B46", # "B50", # "B54", # "B59", # "B79", # "B80", # "B89", # "B91", # "B92", # "B93", # "B94", # "D21", # "D30", # "D42", # "D46", # "D50", # "D79", # "D80", # "D89", # "D91", # "D92", # "D93", # "D94", # "S74", # }, # "Taxes": { # "T01", # "T09", # "T10", # "T11", # "T12", # "T13", # "T14", # "T15", # "T16", # "T19", # "T20", # "T21", # "T22", # "T23", # "T24", # "T25", # "T27", # "T28", # "T29", # "T40", # "T41", # "T50", # "T51", # "T53", # "T99", # }, # "General sales": {"T09"}, # "Selective sales": {"T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19"}, # "License taxes": {"T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29"}, # "Individual income tax": {"T40"}, # "Corporate income tax": {"T41"}, # "Other taxes": {"T01", "T50", "T51", "T53", "T99"}, # "Current charge": { # "A01", # "A03", # "A09", # "A10", # "A12", # "A16", # "A18", # "A21", # "A36", # "A44", # "A45", # "A50", # "A54", # "A56", # "A59", # "A60", # "A61", # "A80", # "A81", # "A87", # "A89", # }, # "Miscellaneous general revenue": { # "U01", # "U11", # "U20", # "U21", # "U30", # "U40", # "U41", # "U50", # "U95", # "U99", # }, # "Utility revenue": {"A91", "A92", "A93", "A94"}, # "Liquor stores revenue": {"A90"}, # "Insurance trust revenue": { # "X01", # "X02", # "X05", # "X08", # "Y01", # "Y02", # "Y04", # "Y10", # "Y11", # "Y12", # "Y50", # "Y51", # "Y52", # }, # "Total expenditure": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "E90", # "E91", # "E92", # "E93", # "E94", # "I89", # "I91", # "I92", # "I93", # "I94", # "J19", # "J67", # "J68", # "J85", # "X11", # "X12", # "Y05", # "Y06", # "Y15", # "Y14", # "Y53", # "Y54", # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "F90", # "F91", # "F92", # "F93", # "F94", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "G90", # "G91", # "G92", # "G93", # "G94", # "M01", # "M04", # "M05", # "M12", # "M18", # "M21", # "M23", # "M25", # "M27", # "M29", # "M30", # "M32", # "M36", # "M44", # "M50", # "M52", # "M54", # "M55", # "M56", # "M59", # "M60", # "M61", # "M62", # "M66", # "M67", # "M68", # "M79", # "M80", # "M81", # "M87", # "M89", # "M91", # "M92", # "M93", # "M94", # "Q12", # "Q18", # "S67", # "S74", # "S89", # }, # "Intergovernmental expenditure": { # "M01", # "M04", # "M05", # "M12", # "M18", # "M21", # "M23", # "M25", # "M27", # "M29", # "M30", # "M32", # "M36", # "M44", # "M50", # "M52", # "M54", # "M55", # "M56", # "M59", # "M60", # "M61", # "M62", # "M66", # "M67", # "M68", # "M79", # "M80", # "M81", # "M87", # "M89", # "M91", # "M92", # "M93", # "M94", # "Q12", # "Q18", # "S67", # "S68", # "S89", # }, # "Direct expenditure": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "E90", # "E91", # "E92", # "E93", # "E94", # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "F90", # "F91", # "F92", # "F93", # "F94", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "G90", # "G91", # "G92", # "G93", # "G94", # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y15", # "Y53", # "Y54", # "J19", # "J67", # "J68", # "J85", # "I89", # "I91", # "I92", # "I93", # "I94", # }, # "Current operation": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "E90", # "E91", # "E92", # "E93", # "E94", # }, # "Capital outlay": { # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "F90", # "F91", # "F92", # "F93", # "F94", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "G90", # "G91", # "G92", # "G93", # "G94", # }, # "Insurance benefits and repayments": { # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y15", # "Y53", # "Y54", # }, # "Assistance and subsidies": {"J19", "J67", "J68", "J85"}, # "Interest on debt": {"I89", "I91", "I92", "I93", "I94"}, # "Exhibit: Salaries and wages": {"Z00"}, # "General expenditure": { # "M01", # "M04", # "M05", # "M12", # "M18", # "M21", # "M23", # "M25", # "M27", # "M29", # "M30", # "M32", # "M36", # "M44", # "M50", # "M52", # "M54", # "M55", # "M56", # "M59", # "M60", # "M61", # "M62", # "M66", # "M67", # "M68", # "M79", # "M80", # "M81", # "M87", # "M89", # "M91", # "M92", # "M93", # "M94", # "Q12", # "Q18", # "S67", # "S89", # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G24", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "I89", # "J19", # "J67", # "J68", # "J85", # }, # "Direct general expenditure": { # "E01", # "E03", # "E04", # "E05", # "E12", # "E16", # "E18", # "E21", # "E22", # "E23", # "E25", # "E26", # "E27", # "E29", # "E31", # "E32", # "E36", # "E44", # "E45", # "E50", # "E52", # "E54", # "E55", # "E56", # "E59", # "E60", # "E61", # "E62", # "E66", # "E73", # "E74", # "E75", # "E77", # "E79", # "E80", # "E81", # "E85", # "E87", # "E89", # "F01", # "F03", # "F04", # "F05", # "F12", # "F16", # "F18", # "F21", # "F22", # "F23", # "F25", # "F26", # "F27", # "F29", # "F31", # "F32", # "F36", # "F44", # "F45", # "F50", # "F52", # "F54", # "F55", # "F56", # "F59", # "F60", # "F61", # "F62", # "F66", # "F77", # "F79", # "F80", # "F81", # "F85", # "F87", # "F89", # "G01", # "G03", # "G04", # "G05", # "G12", # "G16", # "G18", # "G21", # "G22", # "G23", # "G25", # "G26", # "G27", # "G29", # "G31", # "G32", # "G36", # "G44", # "G45", # "G50", # "G52", # "G54", # "G55", # "G56", # "G59", # "G60", # "G61", # "G62", # "G66", # "G77", # "G79", # "G80", # "G81", # "G85", # "G87", # "G89", # "I89", # "J19", # "J67", # "J68", # "J85", # }, # "Education": { # "E12", # "F12", # "G12", # "M12", # "Q12", # "E16", # "F16", # "G16", # "E18", # "F18", # "G18", # "M18", # "Q18", # "J19", # "E21", # "F21", # "G21", # "M21", # }, # "Public welfare": { # "J67", # "M67", # "S67", # "S74", # "J68", # "M68", # "E73", # "E74", # "E75", # "E77", # "F77", # "G77", # "E79", # "M79", # "F79", # "G79", # }, # "Hospitals": {"E36", "F36", "G36", "M36"}, # "Health": {"E27", "E32", "F27", "F32", "G27", "G32", "M27", "M32"}, # # "Health": {"E32", "F32", "G32", "M32"}, # "Highways": {"E44", "M44", "F44", "G44", "E45", "F45", "G45"}, # "Police protection": {"E62", "F62", "G62", "M62"}, # "Correction": {"E04", "M04", "F04", "G04", "E05", "F05", "G05", "M05"}, # "Natural resources": { # "E54", # "E55", # "M54", # "M55", # "E56", # "M56", # "E59", # "M59", # "F54", # "F55", # "F56", # "F59", # "G54", # "G55", # "G56", # "G59", # }, # "Parks and recreation": {"E61", "F61", "G61", "M61"}, # "Governmental administration": { # "E23", # "F23", # "G23", # "M23", # "E25", # "F25", # "G25", # "M25", # "E26", # "F26", # "G26", # "E29", # "M29", # "F29", # "G29", # "E31", # "F31", # "G31", # }, # "Interest on general debt": {"I89"}, # "Other and unallocable": { # "E01", # "F01", # "G01", # "M01", # "E03", # "F03", # "G03", # "E22", # "F22", # "G22", # "M30", # "E50", # "F50", # "G50", # "M50", # "E52", # "F52", # "G52", # "M52", # "E66", # "F66", # "G66", # "M66", # "E80", # "F80", # "G80", # "M80", # "E81", # "F81", # "G81", # "M81", # "E85", # "F85", # "G85", # "J85", # "E87", # "F87", # "G87", # "M87", # "E89", # "F89", # "G89", # "M89", # "S89", # "M91", # "M92", # "M93", # "M94", # }, # "Utility expenditure": { # "E91", # "F91", # "G91", # "I91", # "E92", # "F92", # "G92", # "I92", # "E93", # "F93", # "G93", # "I93", # "E94", # "F94", # "G94", # "I94", # }, # "Liquor stores expenditure": {"E90", "F90", "G90"}, # "Insurance trust expenditure": { # "X11", # "X12", # "Y05", # "Y06", # "Y14", # "Y15", # "Y53", # "Y54", # }, # "Debt at end of fiscal year": {"64V", "44T", "49U"}, # "Cash and security holdings": { # "W01", # "W31", # "W61", # "X21", # "X30", # "Z77", # "Z78", # "X42", # "X44", # "X47", # "Y07", # "Y08", # "Y21", # "Y61", # }, # }
class Solution: def solve(self, nums, k): nums = [0]+nums for i in range(1,len(nums)): nums[i] += nums[i-1] sums = [[nums[i] - x for x in sorted(nums[:i])[:k]] for i in range(1,len(nums))] return sorted(sum(sums,[]))[-k:]
class MyParser: def __init__(self, text_1, text_2): self.text_1 = text_1 self.text_2 = text_2 def parse_text(self, text): stack = [] for char in text: if char != '#': stack.append(char) else: if len(stack) > 0: stack.pop() return ''.join(stack) def check_if_equal(self): return self.parse_text(self.text_1) == self.parse_text(self.text_2)
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Loads dependencies needed to compile Sandboxed API for 3rd-party consumers.""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("//sandboxed_api/bazel:repositories.bzl", "autotools_repository") def sapi_deps(): """Loads common dependencies needed to compile Sandboxed API.""" # Bazel Skylib, needed by newer Protobuf builds maybe( http_archive, name = "bazel_skylib", sha256 = "154f4063d96a4e47b17a917108eaabdfeb4ef08383795cf936b3be6f8179c9fc", # 2020-04-15 strip_prefix = "bazel-skylib-560d7b2359aecb066d81041cb532b82d7354561b", url = "https://github.com/bazelbuild/bazel-skylib/archive/560d7b2359aecb066d81041cb532b82d7354561b.zip", ) # Abseil maybe( http_archive, name = "com_google_absl", sha256 = "e140988c4d3c22f829a3095f0d34a0783aa2f8829556283f10b8eb63a9428b19", # 2021-02-19 strip_prefix = "abseil-cpp-b315753c0b8b4aa4e3e1479375eddb518393bab6", urls = ["https://github.com/abseil/abseil-cpp/archive/b315753c0b8b4aa4e3e1479375eddb518393bab6.zip"], ) maybe( http_archive, name = "com_google_absl_py", sha256 = "6ace3cd8921804aaabc37970590edce05c6664901cc98d30010d09f2811dc56f", # 2019-10-25 strip_prefix = "abseil-py-06edd9c20592cec39178b94240b5e86f32e19768", urls = ["https://github.com/abseil/abseil-py/archive/06edd9c20592cec39178b94240b5e86f32e19768.zip"], ) # Abseil-py dependency for Python 2/3 compatiblity maybe( http_archive, name = "six_archive", build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/six.BUILD", sha256 = "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73", # 2018-12-10 strip_prefix = "six-1.12.0", urls = [ "https://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz", "https://pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz", ], ) # gflags # TODO(cblichmann): Use Abseil flags once logging is in Abseil maybe( http_archive, name = "com_github_gflags_gflags", sha256 = "97312c67e5e0ad7fe02446ee124629ca7890727469b00c9a4bf45da2f9b80d32", # 2019-11-13 strip_prefix = "gflags-addd749114fab4f24b7ea1e0f2f837584389e52c", urls = ["https://github.com/gflags/gflags/archive/addd749114fab4f24b7ea1e0f2f837584389e52c.zip"], ) # Google logging # TODO(cblichmann): Remove dependency once logging is in Abseil maybe( http_archive, name = "com_google_glog", sha256 = "feca3c7e29a693cab7887409756d89d342d4a992d54d7c5599bebeae8f7b50be", # 2020-02-16 strip_prefix = "glog-3ba8976592274bc1f907c402ce22558011d6fc5e", urls = ["https://github.com/google/glog/archive/3ba8976592274bc1f907c402ce22558011d6fc5e.zip"], ) # Protobuf maybe( http_archive, name = "com_google_protobuf", sha256 = "bf0e5070b4b99240183b29df78155eee335885e53a8af8683964579c214ad301", # 2020-11-14 strip_prefix = "protobuf-3.14.0", urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.14.0.zip"], ) # libcap http_archive( name = "org_kernel_libcap", build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libcap.BUILD", sha256 = "260b549c154b07c3cdc16b9ccc93c04633c39f4fb6a4a3b8d1fa5b8a9c3f5fe8", # 2019-04-16 strip_prefix = "libcap-2.27", urls = ["https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.27.tar.gz"], ) # libffi autotools_repository( name = "org_sourceware_libffi", build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libffi.BUILD", sha256 = "653ffdfc67fbb865f39c7e5df2a071c0beb17206ebfb0a9ecb18a18f63f6b263", # 2019-11-02 strip_prefix = "libffi-3.3-rc2", urls = ["https://github.com/libffi/libffi/releases/download/v3.3-rc2/libffi-3.3-rc2.tar.gz"], ) # libunwind autotools_repository( name = "org_gnu_libunwind", build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libunwind.BUILD", configure_args = [ "--disable-documentation", "--disable-minidebuginfo", "--disable-shared", "--enable-ptrace", ], sha256 = "3f3ecb90e28cbe53fba7a4a27ccce7aad188d3210bb1964a923a731a27a75acb", # 2017-06-15 strip_prefix = "libunwind-1.2.1", urls = ["https://github.com/libunwind/libunwind/releases/download/v1.2.1/libunwind-1.2.1.tar.gz"], )
class Solution: # 1, 2, 3, 4, 5 # n = 5 # Rotate - k = 2 - Left - 4, 5, 1, 2, 3 # Rotate - k = 3 (n - 2) - Right - 4, 5, 1, 2, 3 def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void """ n = len(nums) if (n == 1 or k == 0 or n == k): return k = k % n g_c_d = self.gcd(n, k) for idx in range(g_c_d): jdx = idx prev = nums[jdx] while True: # kdx points to the element under consideration kdx = (jdx + k) % n # Swapping the previous element with the current element prev, nums[kdx] = nums[kdx], prev jdx = kdx if jdx == idx: break def gcd(self, m, n): """ :type m: int :type n: int :rtype: int """ if (m % n == 0): return n else: return self.gcd(n, m % n) def rotate2(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void """ k = k % len(nums) nums[:] = nums[-k:] + nums[:-k] def rotate_like_gcd_but_better(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void """ n = len(nums) k %= n start = count = 0 while count < n: current, prev = start, nums[start] while True: next_idx = (current + k) % n nums[next_idx], prev = prev, nums[next_idx] current = next_idx count += 1 if start == current: break start += 1 nums = [1, 2, 3, 4, 5, 6, 7] Solution().rotate(nums, 3) print (nums)
# -*- coding: utf-8 -*- """ 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 判断是否回文,可以依次获取数字的首尾数字进行比较。数字首位可从循环获取,尾部通过% 获取。 """ class Solution: def is_palindrome(self, x): if x < 0: return False div = 1 # 循环获取div为了下面步骤得到首位数字 while x / div >= 10: div *= 10 while x > 0: l = x // div # 首位 r = x % 10 # % 获取尾部 if l != r: return False x %= div # 除去首位 x //= 10 # 除去尾位 div //= 100 # 最高位除数相应除去100 return True if __name__ == '__main__': solution = Solution() print(solution.is_palindrome(12321)) print(solution.is_palindrome(123))
#!/usr/bin/python3 # Both the Minimax and the Alpha-beta algorithm represent the players # as integers 0 and 1. The moves by the two players alternate 0, 1, 0, 1, ..., # so in the recursive calls you can compute the next player as the subtraction # 1-player. # The minimizing player is always 0 and the maximizing 1. # The number of recursive calls to the algorithms is kept track with # the variable 'calls'. Let your implementation increase this variable # by one in the beginning of each recursive call. This variable is # also used as part of the evaluation of the implementations. calls = 0 def minimax(player, state, depthLeft): """ Perform recursive min-max search of a game tree rooted in `state`. Returns the best value in the min-max sense starting from `state` for `player` using at most `depthLeft` recursive calls. Gives value of state if depthLeft = 0 or the state has no further actions (a leaf in the game-tree). Parameters ---------- player : int in {0,1} 0 is the minimizing player, and 1 maximizing. state : Object representing game state. See `gameexamples.py` for examples. depthLeft : int >= 0 Maximum number of recursive levels to perform, including this this call to minmax. Returns ------- float Best value. """ global calls calls += 1 if depthLeft == 0: return state.value() actions = state.applicableActions(player) if not actions: return state.value() player2 = 1 - player best = float('inf') if player == 0 else - float('inf') for action in actions: state2 = state.successor(player, action) v = minimax(player2, state2, depthLeft - 1) if player == 0: best = min(best, v) else: best = max(best, v) return best def alphabeta(player, state, depthLeft, alpha, beta): """ Perform recursive alpha/beta search of game tree rooted in `state`. Returns the best value in the alpha/beta sense starting from `state` for `player` using at most `depthLeft` recursive calls. Gives value of state if depthLeft = 0 or the state has no further actions (a leaf in the game-tree). Parameters ---------- player : int in {0,1} 0 is the minimizing player, and 1 maximizing. state : Object representing game state. See `gameexamples.py` for examples. depthLeft : int >= 0 Maximum number of recursive levels to perform, including this call to alphabeta. alpha : float Current alpha cut value. beta : float Current beta cut value. Returns ------- float Best value. """ global calls calls += 1 if depthLeft == 0: return state.value() actions = state.applicableActions(player) if not actions: return state.value() player2 = 1 - player best = float('inf') if player == 0 else - float('inf') for action in actions: state2 = state.successor(player, action) v = alphabeta(player2, state2, depthLeft - 1, alpha, beta) if player == 0: best = min(best, v) beta = min(beta, v) else: best = max(best, v) alpha = max(alpha, v) if alpha >= beta: break return best def gamevalue(startingstate, depth): global calls calls = 0 v = minimax(0, startingstate, depth) print(str(v) + " value with " + str(calls) + " calls with minimax to depth " + str(depth)) calls = 0 v = alphabeta(0, startingstate, depth, 0 - float("inf"), float("inf")) print(str(v) + " value with " + str(calls) + " calls with alphabeta to depth " + str(depth)) calls = 0
""" Make a program that reads the width and height of a wall in meters, calculate its area and the amount of paint needed to paint it, knowing that each liter of paint, paints an area of 2m². """ wallWidth = float(input('Largura da parede: ')) wallHeight = float(input('Altura da parede: ')) print('Sua parede tem a dimensão de {}x{} e sua área é de {}m².'.format(wallWidth, wallHeight, wallWidth * wallHeight) + '\nPara pintar essa parede, você precisará de {} litros de tinta.'.format(wallWidth * wallHeight / 2))
if __name__ == '__main__': n = int(input()) arr =list(map(int, input().split(" "))) i = max(arr) for i in range(0,n): if max(arr) == i: arr.remove(max(arr)) arr.sort(reverse=True) print(arr[0])
n=int(input()) p=[[int(i)for i in input().split()] for _ in range(n)] p.sort(key=lambda x: x[2]) a,b,c=p[-1] for y in range(101): for x in range(101): h=c+abs(a-x)+abs(b-y) if all(k==max(h-abs(i-x)-abs(y-j),0) for i,j,k in p): print(x,y,h) exit()
# Copyright (c) 2021 Hashz Software. class ArgNotFound: def __init__(self, arg): print("ArgNotFound: %s" % arg)
""" 213. House Robber II You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police. Example 1: Input: [2,3,2] Output: 3 Explanation: You cannot rob house 1 (money = 2) and then rob house 3 (money = 2), because they are adjacent houses. Example 2: Input: [1,2,3,1] Output: 4 Explanation: Rob house 1 (money = 1) and then rob house 3 (money = 3). Total amount you can rob = 1 + 3 = 4. """ # Runtime: 20 ms, faster than 99.21% of Python3 online submissions for House Robber II. # Memory Usage: 12.6 MB, less than 100.00% of Python3 online submissions for House Robber II. class Solution: def rob(self, nums: List[int]) -> int: n = len(nums) if n == 0: return 0 if n <= 3: return max(nums) return max(self.helper(nums[1:]), self.helper(nums[:-1])) def helper(self, arr): n = len(arr) if n <= 2: return 0 dp = [0 for _ in range(n)] dp[0] = arr[0] dp[1] = arr[1] dp[2] = arr[2] + arr[0] for i in range(3, n): dp[i] = max(dp[i-2], dp[i-3]) + arr[i] return max(dp[-1], dp[-2])
#These information comes from Twitter API #Create a Twitter Account and Get These Information from apps.twitter.com consumer_key = 'R1feyoEHAw2Lg32k4OKyyn01v' consumer_secret = 'KdxSi79P7PAjhmY4OYU2VfeKUcaUt4WmyJMb7Oew0nE1M7Ji5h' access_token = '145566333-KIndElco5MlHXPIGWeGkvjVXlMchLyQI2bMD8BJT' access_secret = 'iqfFlcM4clh6wCwDSLZaQqJttgstiIybUDOoB3uyzaZx8'
class lightswitch: is_on = False def Flip(self): #self refers to the instance of the object. needs to be included only when using class, to ensure that it is defined only within the class self.is_on = not self.is_on #field/attribute print(self.is_on) def FlipMany(self, number:int): for i in range(number): self.Flip() living_room_light = lightswitch() #object bedroom_light = lightswitch() print('living_room_light:') living_room_light.FlipMany(13) print('bedroom_light:') bedroom_light.FlipMany(4) print(type(bedroom_light)) #built type print(dir(bedroom_light)) #print all the methods within the class, including the ones u have created
if __name__ == "__main__": TC = int(input()) for t in range(0,TC): N = int(input()) max_score = -1 tie = False win = 0 for n in range(0,N): T = [0] * 6 C = list(map(int, input().split())) for c in range(1,len(C)): T[C[c]-1]+=1 T.sort() score = C[0] score += T[0]*4 T[1] -= T[0]; T[2] -= T[0]; score += T[1]*2 T[2] -= T[1]; score += T[2]; #print(T) #print(score) if score > max_score: tie = False max_score = score win = n elif score == max_score: tie = True max_score = score win = n if tie: print("tie") elif win == 0: print("chef") else: print(win+1)
def value_at(poly_spec, x): num=1 total=0 for i,j in enumerate(poly_spec[::-1]): total+=j*num num=(num*(x-i))/(i+1) return round(total, 2)
class BaseGenerator: """Base class for generators. Generators should provide of synthesis measurements for a location. For performance reasons generation of data should be initialized by the :meth:`uwb.generator.BaseGenerator.gen`. and :meth:`uwb.generator.BaseGenerator.get_closest_position` should provide the indices for the given coordinates. """ def __init__(self): pass def gen(self): """Initializes the generation process.""" pass def __iter__(self): """Iterator implementation for generator. Returns the data per measurement location. General layout should be (np.array, index, position), where the position should match the shape of the underlying structure. """ pass def get_closest_position(self, coordinates): """Finds indices in the map for the given coordinates. Method provides indices in the map for the underlying geometry of the location. Attributes: coordinates: coordinates to look up map position. """ pass @property def shape(self): """Shape of the underlying structure. Shape of the underlying structure. This will be used for pre-allocation. In most cases a grid structure is preferable. Having positions with no measurements are easier to deal with than obscure shapes. For memory efficiency this decision can be altered. """ return (1,)
REV_CLASS_MAP = { 0: "rock", 1: "paper", 2: "scissors", 3: "none" } # 0_Rock 1_Paper 2_Scissors def mapper(val): return REV_CLASS_MAP[val] def calculate_winner(move1, move2): if move1 == move2: return "Tie" if move1 == "rock": if move2 == 2: return "User" if move2 == 1: return "Computer" if move1 == "paper": if move2 == 0: return "User" if move2 == 2: return "Computer" if move1 == "scissors": if move2 == 2: return "User" if move2 == 0: return "Computer"
class ArtistNotFound(Exception): pass class AlbumNotFound(Exception): pass
standard = { 'rulebook_white': { 'name':'Rulebook White T', 'style': { 'color': '#666666', 'background': '#fff', 'border-color': '#000', }, }, 'rulebook_pink': { 'name':'Rulebook Pink', 'style': { 'color': '#ffffdd', 'background': '#F25292', 'border-color': '#FE98C0', }, }, 'rulebook_blue': { 'name':'Rulebook Blue', 'style': { 'color': '#000', 'background': '#CCE5F3', }, }, 'endeavor': { 'name': 'Endeavor', 'style': { 'color': '#fff', 'background': '#997030', }, }, 'the_watcher': { 'name': 'The Watcher', 'style': { 'color': '#E5BE2F', 'background': '#414042', }, }, 'twilight_knight': { 'name': 'Twilight Knight', 'style': { 'border-color': "#000", 'background': 'radial-gradient(#919B9A, #273736, #0D1110)', 'color': '#fff', }, }, 'sunstalker': { 'name': 'Sunstalker', 'style': { 'background': 'radial-gradient(#907859, #5D5B2E, #24271F)', 'color': '#ffff00', }, }, 'innovate': { 'name': 'Innovation', 'style': { 'border-color': "#0277BD", 'background': 'linear-gradient(to bottom, #4EC7F1, #40ADD0)', 'color': '#fff', }, }, 'location': { 'name': 'Location', 'style': { 'border-color': '#0D743A', 'background': 'linear-gradient(to bottom, #73C26C, #51B952)', 'color': '#fff', }, }, 'dying_lantern': { 'name': 'Dying Lantern', 'style': { 'border-color': "#666", 'background': 'radial-gradient(#C2BA95, #B19A55)', 'color': '#fff', }, }, 'bloodskin': { 'name': 'Bloodskin', 'style': { 'border-color': "#371516", 'background': 'radial-gradient(#BF8D83, #5F1711)', 'color': '#fff', }, }, 'fade': { 'name': 'Fade', 'style': { 'border-color': "#000", 'background': 'radial-gradient(#585550, #26252A)', 'color': '#E5E4E2', }, }, 'vibrant_lantern': { 'name': 'Vibrant Lantern', 'style': { 'border-color': "", 'background': 'radial-gradient(#DED6B3, #E7CE32)', 'color': '#000', }, }, 'proxy_1': { 'name': 'Proxy 1 (Red)', 'style': { 'border-color': "#660000", 'background': 'radial-gradient(#B14529, #9F3E25)', 'color': '#FFF', }, }, 'proxy_2': { 'name': 'Proxy 2 (Brown)', 'style': { 'border-color': "#666", 'background': 'radial-gradient(#5C2800, #572500)', 'color': '#FFF', }, }, 'proxy_3': { 'name': 'Proxy 3 (Green)', 'style': { 'border-color': "#006600", 'background': 'radial-gradient(#ABC0A4, #9FB193)', 'color': '#FFF', }, }, 'proxy_4': { 'name': 'Proxy 4 (Blue)', 'style': { 'border-color': "#000066", 'background': 'radial-gradient(#3261AD, #2D5394)', 'color': '#FFF', }, }, }
def recurFibonaci(number): if number <= 1: return number else: return recurFibonaci(number - 1) + recurFibonaci(number - 2) numberTerms = 10 if numberTerms <= 0: print("enter positive integers") else: print("fibonaci sequence ") for i in range(numberTerms): print(recurFibonaci(i))
cadena_ingresada = input("Ingrese la fecha actual en formato dd/mm/yyyy: "); separado = cadena_ingresada.split('/'); print(separado); print( f'Dia: {separado[0]}', '-', f'Mes: {separado[1]}', '-', f'Anio: {separado[2]}' ); c = cadena_ingresada; print( f'Dia: {c[0]}{c[1]}', '-', f'Mes: {c[3]}{c[4]}', '-', f'Anio: {c[6]}{c[7]}{c[8]}{c[9]}' );
carros = [] carros.append("audi") carros.append("bmw") carros.append("subaru") carros.append("toyota") carros.append("chevrolet") carros.append("honda") # if elif else for carro in carros: if carro == "honda": print(carro.upper() + " !") elif carro == "BMW": print(carro.upper()) elif carro == "toyota": print(carro.upper() + " !") else: print(carro.title() + " *") print("------\n") # multiplas condicionais for x in range(0, int(len(carros))): if(carros[x] == "audi" and carros[x + 1] == "bmw"): print(str(x)) if(carros[x] == "chevrolet" and carros[x + 1] == "honda"): print(str(x)) # mais condicionais recheios_disponiveis = [] recheios_disponiveis.append("champignon") recheios_disponiveis.append("azeite") recheios_disponiveis.append("presunto") recheios_disponiveis.append("pepperoni") recheios_disponiveis.append("abacaxi") recheios_disponiveis.append("borda de cheddar") # teste input a = raw_input() print("------") if not a: print("null") else: print(a) print("------") # input com condicionais recheios_solicitados = [] recheio_pizza = [] pedido = raw_input() while pedido: recheios_solicitados.append(str(pedido)) pedido = raw_input() for recheio_solicitado in recheios_solicitados: if recheio_solicitado in recheios_disponiveis: print("recheio " + recheio_solicitado + " adicionado com sucesso!") recheio_pizza.append(recheio_solicitado) else: print("recheio " + recheio_solicitado + " indisponivel no momento :(") print("Pizza montada com os seguintes recheios:") print(recheio_pizza)
# Digit factorials def factorial(n): if n == 0: return 1 return n*factorial(n-1) def digitized_factorial_sum(num): if num == 1 or num == 2: return False return sum([factorial(int(digit)) for digit in str(num)]) == num # Need bounds on the numbers to be checked if their sum of factorial of digits is equal # to the original number. for i in range(int(1e6)): if digitized_factorial_sum(i): print("The number {} is equal to the sum of the factorial of its digits.\n".format(i))
# Question 2 - Shouting! def main(): # You don't need to modify this function. name = input('Please enter your name: ') # The computer is pleased to see you! Shout out to the user shout_name = shout(name) print('This program is happy to see you, {}'.format(shout_name)) def shout(name): # TODO return the name in uppercase with !!! at the end. # Example: if the name is 'Beyonce' then return 'BEYONCE!!!' pass # TODO replace this with your code # You don't need to modify the following code. if __name__ == "__main__": main()
''' Refaça o DESAFIO 035 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado: - EQUILÁTERO: todos os lados iguais - ISÓSCELES: dois lados iguais, um diferente - ESCALENO: todos os lados diferentes ''' print('------- ANALISANDO TRIANGULO ---------') n1 = float(input('Digite o Primeiro Segmento: ')) n2 = float(input('Digite o Segundo Segmento: ')) n3 = float(input('Digite o Terceiro Segmento: ')) if n1 < n2 + n3 and n2 < n1 + n3 and n3 < n1 + n2: print('Os Segmentos \033[35m Formam \033[m uma Reta ') if n1 == n2 and n1 == n3 and n2 == n3: print('Triangulo EQUILATERO') elif n1 != n2 and n1 != n3 and n2 != n3: print('É uma Triangulo ECALENO') elif n1 != n2 and n1 == n3: print('Triangulo ISOSCELES') elif n1 == n2 and n1 != n3: print('Triangulo ISÓSCELES') elif n2 != n1 and n2 == n3: print('Triangulo ISÓSCELES') elif n2 == n1 and n2 != n3: print('Triangulo ISÓSCELES') elif n3 != n1 and n3 == n2: print('Triangulo ISOSCELES') elif n3 == n1 and n3 != n2: print('Triangulo ISOSCELES') else: print('\033[31m Nao Formam \033[m um Triangulo ')
#python3 # Compute the last digit of the sum of squares of Fibonacci numbers till Fn def fib_mod_sum(n): mod_seq = [0, 1] # mod is 10 -> pisano period is 60 pp = 60 fib_i = n % pp for _ in range(1, fib_i): mod_seq.append((mod_seq[-1] + mod_seq[-2])) fn_seq = mod_seq[:fib_i + 1] return sum([i**2 for i in fn_seq]) % 10 def main(): n = int(input()) print(fib_mod_sum(n)) if __name__ == "__main__": main()
__title__ = 'django-uuslug' __author__ = 'Val Neekman' __author_email__ = 'info@neekware.com' __description__ = "A Django slugify application that also handles Unicode" __url__ = 'https://github.com/un33k/django-uuslug' __license__ = 'MIT' __copyright__ = 'Copyright 2022 Val Neekman @ Neekware Inc.' __version__ = '2.0.0'
class Quadrado: def __init__(self, lado): self.lado = lado def perimetro(self): return 4 * self.lado def area(self): return self.lado * self.lado class Retangulo: def __init__(self, base, altura): self.base = base self.altura = altura def area(self): return self.base * self.altura
# https://codeforces.com/problemset/problem/510/A n, m = input().split() whileloop_count = 1 dotline = 0 k = int(m)-1 while whileloop_count <= int(n): if whileloop_count % 2 != 0: print("#"*int(m)) elif whileloop_count % 2 == 0 and dotline % 2 == 0: print(("."*k+"#")) dotline += 1 elif whileloop_count % 2 == 0 and dotline % 2 != 0: print("#"+("."*k)) dotline += 1 whileloop_count += 1
minha_lista = [1,2,3,4,5] sua_lista = [item ** 2 for item in minha_lista] print(minha_lista) print(sua_lista)
""" Activity Selection problem You are given n activities with their start and finish times. Select the maximum number of activities that can be performed by a single person, assuming that a person can only work on a single activity at a time. Example: Example 1 : Consider the following 3 activities sorted by by finish time. start[] = {10, 12, 20}; finish[] = {20, 25, 30}; A person can perform at most two activities. The maximum set of activities that can be executed is {0, 2} [ These are indexes in start[] and finish[] ] Example 2 : Consider the following 6 activities sorted by by finish time. start[] = {1, 3, 0, 5, 8, 5}; finish[] = {2, 4, 6, 7, 9, 9}; A person can perform at most four activities. The maximum set of activities that can be executed is {0, 1, 3, 4} [ These are indexes in start[] and finish[] ] The greedy choice is to always pick the next activity whose finish time is least among the remaining activities and the start time is more than or equal to the finish time of previously selected activity. We can sort the activities according to their finishing time so that we always consider the next activity as minimum finishing time activity. 1) Sort the activities according to their finishing time 2) Select the first activity from the sorted array and print it. 3) Do following for remaining activities in the sorted array. …….a) If the start time of this activity is greater than or equal to the finish time of previously selected activity then select this activity and print it. """ def printMaxActivities(s, f): """params s start time f finish time """ n = len(s) # all of activities i = 0 print(i, end=' ') for j in range(n): if s[j] >= f[i]: print(j, end=' ') i = j s = [1, 3, 0, 5, 8, 5] f = [2, 4, 6, 7, 9, 9] printMaxActivities(s, f)
"""Faça um programa que leia o peso de várias pessoas, guardando tudo em uma lista. No final mostre: A) Quantas pessoas forma cadastradas. B) Uma listagem com as pessoas mais pesadas. C) Uma listagem com as pessoas mais leves.""" sair = '' contador = maior = menor = 0 pesolista = [] peso = [] while True: peso.append(str(input('Qual é o nome da pessoa? '))) peso.append(float(input('Qual é o peso da pessoa? '))) if len(pesolista) == 0: maoir = menor = peso[1] else: if peso[1] > maior: maior = peso[1] elif peso[1] < menor: menor = peso[1] pesolista.append(peso[:]) peso.clear() contador += 1 sair = str(input('Deseja continar? [s/n] ')).lower().strip() if sair == 'n': break print(f'Foram cadastradas {contador} pessoas.') print(f'O menor peso encontrado é {menor} e as pessoas com o menor peso são: ', end='') for p in pesolista: if p[1] == menor: print(f'{p[0]} ', end='') print(f'\nO maior peso encontrado é {maior} e as pessoas com o mair peso são: ', end='') for p in pesolista: if p[1] == maior: print(f'{p[0]} ', end='') print()
#!/usr/bin/python # -*- coding:utf-8 -*- class Cursor: def __init__(self, x=0, y=0): self.x = x self.y = y self.x_max = 5 self.y_max = 32 def up(self, buff): return Cursor(self.x - 1, self.y).clamp(buff) def down(self, buff): return Cursor(self.x + 1, self.y).clamp(buff) def right(self, buff): return Cursor(self.x, self.y + 1).clamp(buff) def left(self, buff): return Cursor(self.x, self.y - 1).clamp(buff) def clamp(self, buff): x = max(min(self.x, self.line_height(buff)), 0) y = max(min(self.y, self.line_length(buff)), 0) return Cursor(x, y) def move_to_y(self, y): return Cursor(self.x, y) def line_length(self, buff): return len(buff.lines[self.x]) def line_height(self, buff): return len(buff.lines)
# coding=utf-8 # so this should look something like this: $ gunicorn --workers=2 app.memory.app:app ¯\_(ツ)_/¯ MEMORY_SIZE = 10000000 def app(environ, start_response): """Simplest possible application object""" data = b'Hello, World!\n' status = '200 OK' response_headers = [ ('Content-type','text/plain'), ('Content-Length', str(len(data))) ] start_response(status, response_headers) foo = "0" * MEMORY_SIZE del foo return iter([data])
# Fern Zapata # https://github.com/fernzi/dotfiles # Qtile Window Manager - User settings terminal = 'alacritty' launcher = 'rofi -show drun' switcher = 'rofi -show window' file_manager = 'pcmanfm-qt' wallpaper = '~/Pictures/Wallpapers/Other/Waves.png' applications = dict( messenger='discord', mixer='pavucontrol-qt', web_browser='qutebrowser', ) autostart = [ 'lxqt-policykit-agent', 'setxkbmap -option compose:ralt', 'ibus-daemon -dxr', 'picom --experimental-backends', 'nm-applet', 'blueman-applet', ]
#--- # title: Zen Markdown Demo # author: Dr. P. B. Patel # date: CURRENT_DATE # output: # format: pdf #--- ## with sql # %%{sql} """SELECT * FROM stocks""" #``` # %%{run=true, echo=true, render=true} zen.to_latex() #``` # with custom con string # %%{sql, con_string=my_con_string, name=custom_df} """SELECT * FROM stocks""" #``` # %%{run=true, echo=true, render=true} custom_df.to_latex() #```
# -*- coding: utf-8 -*- """ Created on Mon Jan 04 2021 - 10:22 Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed A complimentary exercise from the book companion, the OCW video lecture series - Lecture 6 Song Lyrics parser https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/lecture-videos/index.htm @author: Atanas Kozarev - github.com/ultraasi-atanas """ def removePunctuation(s): """ Parameters ---------- s : string Song lyrics string Returns ------- converted : string A copy of s with removed punctuation and all letters turned to lowercase. """ s = s.lower() converted = '' for c in s: if c in "abcdefghijklmnopqrstuvwxyz ": converted += c return converted def lyrics_to_frequencies(l): """ Assumes l is a list with strings Takes each string and checks if it exists as a key in the dict If it does - it increases the value of that key by 1 If it doesn't - it creates the key with value 1 Parameters ---------- l : list list with strings, words of song lyrics. Returns ------- frequenciesDict : dict contains distinct list entries as keys and their number of occurences as values """ frequenciesDict = {} for word in l: if word in frequenciesDict: frequenciesDict[word] = frequenciesDict[word] + 1 else: frequenciesDict[word] = 1 return frequenciesDict def mostCommon(d): """ Parameters ---------- d : dict words and frequencies value pairs Returns ------- a tuple containing the highest frequency and the respective word(s) list """ mostCommonValue = max(d.values()) results = [] for e in d: if d[e] == mostCommonValue: results.append(e) return (results,mostCommonValue) # 1 Step lyrics = """'A Place In This World I don't know what I want, so don't ask me Cause I'm still trying to figure it out Don't know what's down this road, I'm just walking Trying to see through the rain coming down Even though I'm not the only one Who feels the way I do [Chorus:] I'm alone, on my own, and that's all I know I'll be strong, I'll be wrong, oh but life goes on Oh, I'm just a girl, trying to find a place in this world Got the radio on, my old blue jeans And I'm wearing my heart on my sleeve Feeling lucky today, got the sunshine Could you tell me what more do I need And tomorrow's just a mystery, oh yeah But that's ok [Chorus] Maybe I'm just a girl on a mission But I'm ready to fly I'm alone, on my own, and that's all I know I'll be strong, I'll be wrong, oh but life goes on Oh I'm alone, on my own, and that's all I know Oh I'm just a girl, trying to find a place in this world Oh I'm just a girl Oh I'm just a girl, oh, oh, Oh I'm just a girl """ # 2 Step lyricsNoLineEnds = lyrics.replace('\n',' ') lyricsTextOnly = removePunctuation(lyricsNoLineEnds) lyricsList = lyricsTextOnly.split(' ') # 3 Step lyricsFrequencies = lyrics_to_frequencies(lyricsList) # 4 Step print(lyricsFrequencies) print('Most common word is:', mostCommon(lyricsFrequencies))
# http://www.geeksforgeeks.org/find-number-of-triangles-possible/ def number_of_triangles(input): input.sort() count = 0 for i in range(len(input)-2): k = i + 2 for j in range(i+1, len(input)): while k < len(input) and input[i] + input[j] > input[k]: k = k + 1 count += k - j - 1 return count if __name__ == '__main__': input = [15, 9, 8, 3, 4, 5, 6] print(number_of_triangles(input))
def primeCheck(n): # 0, 1, even numbers greater than 2 are NOT PRIME if n==1 or n==0 or (n % 2 == 0 and n > 2): return "Not prime" else: # Not prime if divisable by another number less # or equal to the square root of itself. # n**(1/2) returns square root of n for i in range(3, int(n**(1/2))+1, 2): if n%i == 0: return "Not prime" return "Prime"