Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,344 members, 7,957,917 topics. Date: Wednesday, 25 September 2024 at 01:17 AM |
Nairaland Forum / Science/Technology / Programming / Python 3: Exercises And Solutions. (9548 Views)
Salesforce Rest API Example Using Python 3 / Consume Kibana Rest API Using Python 3 / How To Write A Guessing Game Program In Python 3 (2) (3) (4)
(1) (2) (3) (4) (5) (6) (Reply) (Go Down)
Re: Python 3: Exercises And Solutions. by Daddyshome: 8:49am On May 01, 2020 |
Collinsanele:OK, then I'll put an if statement. def unique_num(lis): unique = [x for x in lis if lis.count(x) == 1] if len(unique) > 0: return unique[0] 1 Like |
Re: Python 3: Exercises And Solutions. by Daddyshome: 8:54am On May 01, 2020 |
gbolly1151:It's the indentation. |
Re: Python 3: Exercises And Solutions. by Brukx(m): 11:32am On May 01, 2020 |
jayphe: #Write a Python program that accepts day, month and year from the user and prints the result in this form #prompt user to input dates day=eval(input("day") mnth=eval(input("mnth") year=eval(input("year") #display output print(day,"/",mnth,"/",year) |
Re: Python 3: Exercises And Solutions. by Brukx(m): 11:34am On May 01, 2020 |
Taofeekdboy:How did you get a server? |
Re: Python 3: Exercises And Solutions. by Brukx(m): 11:37am On May 01, 2020 |
jayphe:what should be the inputable variables in this program? |
Re: Python 3: Exercises And Solutions. by Brukx(m): 11:49am On May 01, 2020 |
jayphe: #prompt user to enter number number=eval(input("input number:") if number/2==0: print("The number is even" else: print("The number is odd" Nairaland will likely modify some of the codes into smiley |
Re: Python 3: Exercises And Solutions. by SKYQUEST(m): 6:49pm On May 01, 2020 |
Collinsanele: HERE
|
Re: Python 3: Exercises And Solutions. by yemyke001(m): 2:15am On May 04, 2020 |
SKYQUEST: import pandas as pd df = pd.read_excel('naira.xlsx') t_assets= df[df.iloc[:,0]=='Total Assets'].iloc[:, 1].values t_liabilities=df[df.iloc[:,0]=='Total Liabilities'].iloc[:,1].values print(f'The ratio of total_assets to total_liabilities is {t_assets} : {t_liabilities} which is equal to:', (t_assets/t_liabilities)) |
Re: Python 3: Exercises And Solutions. by yemyke001(m): 2:17am On May 04, 2020 |
Using python xlrd library: import xlrd f = xlrd.open_workbook('naira.xlsx') file=f.sheet_by_index(0) total_a =file.cell_value(8,1) total_l=file.cell_value(17,1) print(f'The ratio of total_assets to total_liabilities is {total_a} : {total_l} which is equal to: ',total_a/total_l) |
Re: Python 3: Exercises And Solutions. by jayphe(m): 11:41am On May 09, 2020 |
Phew!! I'm sorry for that long break. I know many people for don vex. I'm sorry. I'm back with an exercise but this one is kinda simple. Exercise 7 Write a Python program that accepts data from the user be it integer, string, char, float or double. The program stores these in a container/array (list or tuple) Finally, the program accepts an index from the user and uses the index to find the respective element if the array created. The program then prints the result.e.g., Let's say a user inputs the following: Sam 12 Ben Lagos 22 Tolu The user then input 3 as the index, the program must return 'Ben' as the output. Collinsanele Taofeekdboy kensmoney Daddyshome Zabiboy and lots more...lol! |
Re: Python 3: Exercises And Solutions. by Collinsanele: 3:58pm On May 09, 2020 |
jayphe: Shouldn't Lagos have an index of 3 from your example |
Re: Python 3: Exercises And Solutions. by Zabiboy: 4:35pm On May 09, 2020 |
Collinsanele: Index numbers start from 0 |
Re: Python 3: Exercises And Solutions. by yemyke001(m): 7:15pm On May 09, 2020 |
jayphe: data = [val for val in input().split(',')] index_ = int(input()) print(data[index_]) Meanwhile python indexing start from 0 |
Re: Python 3: Exercises And Solutions. by Daddyshome: 7:56am On May 10, 2020 |
jayphe:Are the inputs on the same line? |
Re: Python 3: Exercises And Solutions. by Cuterboy(m): 8:13am On May 10, 2020 |
Collinsanele:Do you even understand the syntax he's talking about? Like x^2 + 5x -6 or \sqrt(5x²) http://9jababa.com/junior-maths-are-you-sure-you-can-solve-this-simple-junior-maths/ |
Re: Python 3: Exercises And Solutions. by jayphe(m): 7:57pm On May 10, 2020 |
Thanks for the opinion. I was talking in view of the user. I know the index starts from 0. You wouldn't expect the user to type 4 and the program return the 3rd value he entered. |
Re: Python 3: Exercises And Solutions. by Zabiboy: 8:31pm On May 10, 2020 |
Then use index+1 in your code |
Re: Python 3: Exercises And Solutions. by Hotspotbro(m): 1:08pm On May 11, 2020 |
#project of Hotspotbro print('Welcome to Whoop, our New social media site') Name=input('Enter your Email address') Password=input('Enter your choice password >') |
Re: Python 3: Exercises And Solutions. by SKYQUEST(m): 3:25pm On May 22, 2020 |
yemyke001: nice job sir. |
Re: Python 3: Exercises And Solutions. by chitunelee(m): 5:42pm On May 22, 2020 |
Nyc job guys. I'm kinda new in programming can you guys help me with the benefits python has over other languages |
Re: Python 3: Exercises And Solutions. by yemyke001(m): 6:03pm On May 22, 2020 |
SKYQUEST: Thanks boss |
Re: Python 3: Exercises And Solutions. by SKYQUEST(m): 12:06pm On May 23, 2020 |
what python code would you run on a table with data separated by spaces as shown in the image below to convert it in into a readable excel table; the raw data is also given in the attachment below (ben2):
|
Re: Python 3: Exercises And Solutions. by nwele2017: 12:54pm On May 23, 2020 |
SKYQUEST: Using Pandas read it in as CSV then convert it to xlsx using data name .to_excel.(ie. name of data .yo_excel("name.xlsx" |
Re: Python 3: Exercises And Solutions. by SKYQUEST(m): 1:38pm On May 24, 2020 |
nwele2017: can you read this as CSV, will it work?, methinks the file is not comma separated file. |
Re: Python 3: Exercises And Solutions. by gbolly1151(m): 3:29pm On May 24, 2020 |
SKYQUEST: I think read_csv take optional argument delimiter which can be comma,using spaxe should work |
Re: Python 3: Exercises And Solutions. by Sunijacks(m): 4:23pm On May 24, 2020 |
How long does it take to learn and become this good with python? |
Re: Python 3: Exercises And Solutions. by gbolly1151(m): 4:40pm On May 24, 2020 |
Reserve |
Re: Python 3: Exercises And Solutions. by HappyPagan: 12:30am On May 25, 2020 |
Nice thread. Hope I'm not too late to the party. Let me start from the beginning. |
Re: Python 3: Exercises And Solutions. by HappyPagan: 12:34am On May 25, 2020 |
jayphe: url = "https://www.makeuseof.com/tag/browser-text-based-games/" Code snippet here |
Re: Python 3: Exercises And Solutions. by HappyPagan: 12:42am On May 25, 2020 |
jayphe:
Code snippet |
Re: Python 3: Exercises And Solutions. by HappyPagan: 12:49am On May 25, 2020 |
jayphe:
|
(1) (2) (3) (4) (5) (6) (Reply)
Is 5 Months Enough To Learn Java? / Is Anything Better Than The Netbeans Ide? / How To Generate Unique 10/11 Digits Nuban / BVN With PHP
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 43 |