In Python 3, I am trying to create a program that inputs the user as a 3-digit code And converts them into one of the items in a list, then compares these items to Tuepale with the first (3 digit code) in the list of Tuipelle and prints Full Tupal. Can i see I am using dual which is given the list of shares which are called exchanges MDATA which has been fixed in such a way: will be an ideal input: The related output will be: I am just stuck on and / or for the statement which I think I need. Your point is here: This does not understand Python. In Can be worth in, subscribe to a set Checking for a large amount of data is much more efficient. Your syntax appears to be a mashup for different methods. You may mean: However, because it is directly equivalent to portfolio_list
import shares portfolio_str = input ("please give portfolio list") portfolio_state = portfolio_trale ('', '') Portfolio_State = Portfolio_Strap. (Portfolios_list = Portfoliostratus (',') Print (Portfolio_list) Print () Print (Data 'for data (name, code, name, share_value) = share. EXCHANGE_DATA: & Lt; 6} {: & 8;} Format ('code', 'name', 'value')) Portfolio_list in Code == i: print ('{:: & lt; 6} {: & lt; 20} {: & gt; 8.2f} '. Format (code, name, share_value)) Other: Print ("Failure")
EXCHANGE_DATA = [('(' AIA ',' Okayer '', '1.5', 'AIR', 'Airs', 5.60), ('AMP', 'Emp', 3.22), ('ANZ', 'Engbank Group', 26.25), ('ARG', 'Argogee' 12.22), ('CN' ',' Contact ', 11.22), (' CNU ',' Chorus', 3.01), ('DIL', 'Dilje NT', 5.3), ('dnz', 'dnj property' 2.33), ('EBO', 'Eboss', 1.1),
AIA, AA P, ANZ
Code Name Value AIAACEAR 1.50 AMP AMP 3.22 ANZ UNBANGGROP 26.25
if in code == i Portfolio_list:
, checks that if a given value is included in the list, it checks that if
i has
portfolio_list , checks That is equal to
code
true or
incorrect (which also returns
i portfolio_list what do you want If:
portfolio_list can be long, then make it a set:
if the code in portfolio_lit:
if any (For code == i in portfolio_list):
code in code, but more verbatim and inefficient, it is a Not a good solution.
No comments:
Post a Comment