Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,916 members, 7,956,447 topics. Date: Monday, 23 September 2024 at 12:06 PM |
Nairaland Forum / Science/Technology / Programming / A Thread For Tutorial On Python Programming (143694 Views)
Opportunity To Earn Little Pay Working On Python Assignment. / I want to solve question on python basic / I Have A Very Import Question On Python Syntax (2) (3) (4)
(1) (2) (3) ... (27) (28) (29) (30) (31) (32) (Reply) (Go Down)
Re: A Thread For Tutorial On Python Programming by Skye123: 7:19pm On May 18, 2021 |
I'm sorry for derailing the thread, guys. Pls, can someone explain what mutable and immutable data types are?? I understand that mutable can be changed and immutable cannot be. But, how do you write the codes?? The codes look smh confusing. For example: list_values = [1, 2, 3] set_values = (1, 2, 3) print(id(list_values)) print(id(set_values)) print() list_values += [4, 5, 6] set_values += (4, 5, 6) print(id(list_values)) print(id(set_values)) Output: 515314983168 515315121920 515314983168 515315333056 I don't understand how the code produced that. Pls, can someone explain |
Re: A Thread For Tutorial On Python Programming by Kaydon001: 11:55am On May 19, 2021 |
Skye123: You use Python in-build function id() which is used to get the location of object in memory which is mostly integers “1234838293”. The long integer you are is the location of the list and tuple in the memory of your code and you get different results because list and tuple are mutable even tho they have thesame values in them. You will get thesame results when used with immutable values like integers or strings ... As to how to write code mutability of let’s say a list You can change the values of a list through indexing, you can make use of a for loop, you can also do it through list comprehension e.g prices = [99.95, 72.50, 30.00, 29.95, 55.00] I can change values in the price list using the index method. Say we want to change the price at index 2 which is 30.00 to 104.95 we do that using prices[2] = 104.95 print(prices) Result- [99.95, 72.5, 104.95, 29.95, 55.0] Which show our price list has been updated with the new price at index 2.. you cam read up the other ones 2 Likes |
Re: A Thread For Tutorial On Python Programming by deept(m): 7:21pm On May 22, 2021 |
Hello guys, could you help look at the code; this is what i'm trying to achieve but not quite getting the output desired Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7, 2, bob, 10, and 4 and match the output below. Desired Output Invalid input Maximum is 10 Minimum is 2 num = input("Enter a number: " largest = num smallest = num while True: num = input("Enter a number: " if num == "done": break try: int(num) except: print("Invalid input" continue if largest < num: largest = num elif smallest > num: smallest = num #print(num) print(f"Maximum is {largest}" print(f"Minimum is {smallest}" 1 Like |
Re: A Thread For Tutorial On Python Programming by Stark416: 8:08am On May 24, 2021 |
We are the best software trainers and also we have 5+ years of experience in this field..... best hadoop training in chennai Best Software Training institute in Chennai |
Re: A Thread For Tutorial On Python Programming by zizytd(m): 8:45am On May 24, 2021 |
deept: 1 Like
|
Re: A Thread For Tutorial On Python Programming by deept(m): 11:08am On May 24, 2021 |
thanks @ zizytd i see what you did using a list. I am just starting on python and this was an exercise on loops and iteration, haven't really explored lists. This exercise took a long time for me to solve but learnt a lot on what not to do. eventually got it right: while True: num = input("Enter a number: " try: int(num) except: print("Invalid input" continue num = int(num) if type(num) == int: break largest = num smallest = num while True: num = input("Enter a number: " if num == 'done': break try: int(num) except: print("Invalid input" continue num = int(num) if num > largest: largest = num elif num < smallest: smallest = num print(f"Maximum is {largest}" print(f"Minimum is {smallest}" |
Re: A Thread For Tutorial On Python Programming by deept(m): 11:10am On May 24, 2021 |
@zizytd, also in your code, after the except you put valueerror, is that necessary? |
Re: A Thread For Tutorial On Python Programming by zizytd(m): 11:40am On May 24, 2021 |
nice , weldone . I just started learning late last year but with constant practice, I have become so much better. deept: |
Re: A Thread For Tutorial On Python Programming by zizytd(m): 11:47am On May 24, 2021 |
try and except is to catch possible error messages , for this why I used ValueError because if you put int("bob" you will get a ValueError error. If you don't put the type of error it catches all kinds of errors(eg ValueError,TypeError,OsError etc). So it will still work but the only problem is when you want to catch a particular type of error message. deept: |
Re: A Thread For Tutorial On Python Programming by deept(m): 11:50am On May 24, 2021 |
zizytd: Ok, I see. Muchos gracias |
Re: A Thread For Tutorial On Python Programming by Nobody: 11:59am On May 30, 2021 |
Paapii3d: 01000111010011110100010000100000010100110100000101010110010001010010000001001101010110010010000001010011010011110101010101001100 #ARTHSOS; #PLANETSOS { #GEOENGINEERING #WEATHERMODIFICATION #GMO #BIOTECH #BIOHAZARD #THEELECTROSHAMAN; #SDM; #GENESIS } @RoyalMarines !!! #BOBTHEBUILDER; #RISKY; #042REPORT; #IPOB; #ÓDÚÁ; #MASSOB; #REDLIGHTDISTRICT; #AMBERALERT; #ANONYMOUS; #ENVIRONMENTALHEALTH !!! ENDIF {!!! #BOBRISKY !!!} #MAGBONETIDO #LOTTO #KM48 #RCCG #MOWE #IBAFO #ACEPIXELS #NAIRAMARLEY #NOMANNERS #ITSAMADNESS #SIGMUNDFREUD #BATTABOX #TBT #GDFOLK " @Afam4Eva " |
Re: A Thread For Tutorial On Python Programming by Nobody: 12:00pm On May 30, 2021 |
Paapii3d: 01000111010011110100010000100000010100110100000101010110010001010010000001001101010110010010000001010011010011110101010101001100 #ARTHSOS; #PLANETSOS { #GEOENGINEERING #WEATHERMODIFICATION #GMO #BIOTECH #BIOHAZARD #THEELECTROSHAMAN; #SDM; #GENESIS } @RoyalMarines !!! #BOBTHEBUILDER; #RISKY; #042REPORT; #IPOB; #ÓDÚÁ; #MASSOB; #REDLIGHTDISTRICT; #AMBERALERT; #ANONYMOUS; #ENVIRONMENTALHEALTH !!! ENDIF {!!! #BOBRISKY !!!} #MAGBONETIDO #LOTTO #KM48 #RCCG #MOWE #IBAFO #ACEPIXELS #NAIRAMARLEY #NOMANNERS #ITSAMADNESS #SIGMUNDFREUD #BATTABOX #TBT #GDFOLK " @Afam4Eva " |
Re: A Thread For Tutorial On Python Programming by mosco04: 5:06pm On Jun 04, 2021 |
I’m looking for a programmer to help me do something 30k every month for doing some assignment cause this programming of a thing is not my calling |
Re: A Thread For Tutorial On Python Programming by bodhini: 12:47pm On Jun 05, 2021 |
Thank you for posting such a great article. Online cyber safety classes in Kerala |
Re: A Thread For Tutorial On Python Programming by UARBIAFRAODUA: 3:50pm On Jun 07, 2021 |
python manage.py runserver |
Re: A Thread For Tutorial On Python Programming by Nasww22nasww: 8:34pm On Jun 07, 2021 |
good evening? |
Re: A Thread For Tutorial On Python Programming by Kevinton: 1:35pm On Jun 09, 2021 |
I had a similar issue with my new windows 10! Thanks for your resources since it helped me solve the issue I confronted. You could have this dirtyroulette for getting inspired by wonderful people around the world. |
Re: A Thread For Tutorial On Python Programming by QueTeddy: 10:48am On Jun 15, 2021 |
mosco04: If its in python, sure. |
Re: A Thread For Tutorial On Python Programming by eodorpy: 7:29pm On Jun 15, 2021 |
If you are interested in artificial intelligence and machine learning. Kindly checkout this channel. https://www.youtube.com/watch?v=7x-UEjXQwXQ |
Re: A Thread For Tutorial On Python Programming by Michaelesoimeme(m): 3:57pm On Jun 16, 2021 |
wow!! good work. we can so learn SQL database Postgres very easy to learn https://www.youtube.com/watch?v=uJynCFRJMjA |
Re: A Thread For Tutorial On Python Programming by Michaelesoimeme(m): 7:23am On Jun 17, 2021 |
What is a Variable |Python tutorial for beginners 2021| python tutorial | learn python |programming In this video, I will be showing you how a python variable works I will be showing you how to create a variable the rules involved, the different type of ways you can make your variable readable, how to assign one value to different variables or assign different values to more than one variable all at once, I talked about global keyword and how it is used. this video is all about variables and the different ways you can use them and how to not used them. https://www.youtube.com/watch?v=G-LVOKYgrPg |
Re: A Thread For Tutorial On Python Programming by abatechz(m): 6:56pm On Jun 28, 2021 |
it will still process itbut the only problem is when you want to decypher a particular type of error message. |
Re: A Thread For Tutorial On Python Programming by bedfordng(m): 1:31pm On Jun 30, 2021 |
abatechz:then get dirty with Django or flask for webapp. for me I will recommend Django if you can take the pains to learn it due to its features and premade admin panel. |
Re: A Thread For Tutorial On Python Programming by yihaiwuya: 4:48am On Jul 02, 2021 |
contact |
Re: A Thread For Tutorial On Python Programming by thenews: 8:17pm On Jul 02, 2021 |
Hi Everyone, We run a platform intelligently and instantly matching companies to curated data (science/analytics/engineering) and SWE talent across Africa; The Gradient Boost. We have been building the upskilling wing of our platform enabling users to join affordable live courses led by instructors who have experience working for companies such as AWS, Coursera and numerous other tech startups in Africa. These courses are live - giving you access to an instructor to engage with and get immediate feedback from, the courses are cohort based -enabling you to work with small groups of peers, practical - focused on skills that are relevant to work and affordable - starting as low as $10. The first batch of classes will include; - Introduction to Data Engineering - Building data pipelines using Airflow - Introduction to Data Science - Introduction to Machine Learning - SQL case studies - Project builds (building projects with a mentor) - Introduction to Software Engineering - Building with NoCode - Introduction to Product Management More classes will be added soon If this is something you are interested in please fill in the form below. We will be awarding 3 scholarships to people who complete the form, giving you access to a course of your choosing. Form: https://thegradientboost.typeform.com/to/G6nAG1nU |
Re: A Thread For Tutorial On Python Programming by Luckybelt: 12:02am On Jul 03, 2021 |
i need python programming live online training |
Re: A Thread For Tutorial On Python Programming by Slickbishop(m): 7:25am On Jul 03, 2021 |
Luckybelt: Download datacamp app via Google,u will see the video teaching |
Re: A Thread For Tutorial On Python Programming by yihaiwuya: 8:00am On Jul 03, 2021 |
[sup][/sup] |
Re: A Thread For Tutorial On Python Programming by sweet7oyin(m): 9:16am On Jul 03, 2021 |
I want to learn to create a chat app. I found out you could use django and also python itself. Which would be ideal to learn with Should i learn to create it with django or python. Since django is a python framework |
(1) (2) (3) ... (27) (28) (29) (30) (31) (32) (Reply)
Chronicle Of A Data Scientist/analyst / I Want To Learn Programming. Which Language Should I Start With?
(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. 50 |