Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,152,725 members, 7,816,979 topics. Date: Friday, 03 May 2024 at 10:03 PM |
Nairaland Forum / Nduprincekc's Profile / Nduprincekc's Posts
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (of 35 pages)
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 3:07pm On Aug 05, 2020 |
#Count By #Suppose you want to count from some number start_num by another number count_by until you hit a final number end_num. Use break_num as the variable that you'll change each time through the loop. For simplicity, assume that end_num is always larger than start_num and count_by is always positive. #Before the loop, what do you want to set break_num equal to? How do you want to change break_num each time through the loop? What condition will you use to see when it's time to stop looping? #After the loop is done, print out break_num, showing the value that indicated it was time to stop looping. It is the case that break_num should be a number that is the first number larger than end_num. start_num = #provide some start number end_num = #provide some end number that you stop when you hit count_by = #provide some number to count by # write a while loop that uses break_num as the ongoing number to # check against end_num print(break_num) |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 3:03pm On Aug 05, 2020 |
#Count By Check #Suppose you want to count from some number start_num by another number count_by until you hit a final number end_num, and calculate break_num the way you did in the last quiz. #Now in addition, address what would happen if someone gives a start_num that is greater than end_num. If this is the case, set result to "Oops! Looks like your start value is greater than the end value. Please try again." Otherwise, set result to the value of break_num. start_num = #provide some start number end_num = #provide some end number that you stop when you hit count_by = #provide some number to count by # write a condition to check that end_num is larger than start_num before looping # write a while loop that uses break_num as the ongoing number to # check against end_num print(result) |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 2:49pm On Aug 05, 2020 |
#Tag Counter #Write a for loop that iterates over a list of strings, tokens, and counts how many of them are XML tags. XML is a data language similar to HTML. You can tell if a string is an XML tag if it begins with a left angle bracket "<" and ends with a right angle bracket ">". Keep track of the number of tags using the variable count. #You can assume that the list of strings will not contain empty strings. tokens = ['<greeting>', 'Hello World!', '</greeting>'] count = 0 # write your for loop here print(count) |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 2:24pm On Aug 05, 2020 |
#Zip Coordinates #Use zip to write a for loop that creates a string specifying the label and coordinates of each point and appends it to the list points. Each string should be formatted as label: x, y, z. For example, the string for the first coordinate should be F: 23, 677, 4. x_coord = [23, 53, 2, -12, 95, 103, 14, -5] y_coord = [677, 233, 405, 433, 905, 376, 432, 445] z_coord = [4, 16, -6, -42, 3, -6, 23, -1] labels = ["F", "J", "A", "Q", "Y", "B", "W", "X"] points = [] # write your for loop here for point in points: print(point) |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 2:14pm On Aug 05, 2020 |
#Zip Lists to a Dictionary #Use zip to create a dictionary cast that uses names as keys and heights as values. cast_names = ["Barney", "Robin", "Ted", "Lily", "Marshall"] cast_heights = [72, 68, 72, 66, 76] cast = # replace with your code print(cast) |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 6:52pm On Aug 03, 2020 |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 6:48pm On Aug 02, 2020 |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 11:45pm On Jul 28, 2020 |
verse_dict = {'if': 3, 'you': 6, 'can': 3, 'keep': 1, 'your': 1, 'head': 1, 'when': 2, 'all': 2, 'about': 2, 'are': 1, 'losing': 1, 'theirs': 1, 'and': 3, 'blaming': 1, 'it': 1, 'on': 1, 'trust': 1, 'yourself': 1, 'men': 1, 'doubt': 1, 'but': 1, 'make': 1, 'allowance': 1, 'for': 1, 'their': 1, 'doubting': 1, 'too': 3, 'wait': 1, 'not': 1, 'be': 1, 'tired': 1, 'by': 1, 'waiting': 1, 'or': 2, 'being': 2, 'lied': 1, 'don\'t': 3, 'deal': 1, 'in': 1, 'lies': 1, 'hated': 1, 'give': 1, 'way': 1, 'to': 1, 'hating': 1, 'yet': 1, 'look': 1, 'good': 1, 'nor': 1, 'talk': 1, 'wise': 1} print(verse_dict, '\n') # find number of unique keys in the dictionary num_keys = print(num_keys) # find whether 'breathe' is a key in the dictionary contains_breathe = print(contains_breathe) # create and sort a list of the dictionary's keys sorted_keys = # get the first element in the sorted list of keys print() # find the element with the highest value in the list of keys print() bonus_question_what_is_the_first_key_in_verse_dict = |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 11:45pm On Jul 28, 2020 |
#COUNT UNIQUE WORDS #Your task for this quiz is to find the number of unique words in the text. In the code editor below, complete these three steps to get your answer. #1. Split verse into a list of words. Hint: You can use a string method you learned in the previous lesson. #2. Convert the list into a data structure that would keep only the unique elements from the list. #3. Print the length of the container. verse = "if you can keep your head when all about you are losing theirs and blaming it on you if you can trust yourself when all men doubt you but make allowance for their doubting too if you can wait and not be tired by waiting or being lied about don’t deal in lies or being hated don’t give way to hating and yet don’t look too good nor talk too wise" print(verse, '\n') # split verse into list of words verse_list = print(verse_list, '\n') # convert list to a data structure that stores unique elements verse_set = print(verse_set, '\n') # print the number of unique words num_unique = print(num_unique, '\n') |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 11:45pm On Jul 28, 2020 |
elements = {'hydrogen': {'number': 1, 'weight': 1.00794, 'symbol': 'H'}, 'helium': {'number': 2, 'weight': 4.002602, 'symbol': 'He'}} # todo: Add an 'is_noble_gas' entry to the hydrogen and helium dictionaries # hint: helium is a noble gas, hydrogen isn't #hint: After inserting the new entries you should be able to perform these lookups: #>>>print(elements['hydrogen']['is_noble_gas']) #<<< False #>>> print(elements['helium']['is_noble_gas']) #<<< True |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 11:44pm On Jul 28, 2020 |
# Define a Dictionary, population, # that provides information # on the world's largest cities. # The key is the name of a city # (a string), and the associated # value is its population in # millions of people. # Key | Value # Shanghai | 17.8 # Istanbul | 13.3 # Karachi | 13.0 # Mumbai | 12.5 |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 11:44pm On Jul 28, 2020 |
# Use this playground to experiment with list methods, using Test Run |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 11:43pm On Jul 28, 2020 |
#Quiz: Slicing Lists #Select the three most recent dates from this list using list slicing notation. Hint: negative indexes work in slices! eclipse_dates = ['June 21, 2001', 'December 4, 2002', 'November 23, 2003', 'March 29, 2006', 'August 1, 2008', 'July 22, 2009', 'July 11, 2010', 'November 13, 2012', 'March 20, 2015', 'March 9, 2016'] # TODO: Modify this line so it prints the last three elements of the list print(eclipse_dates) |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 10:07pm On Jul 28, 2020 |
#Quiz: List Indexing #Use list indexing to determine how many days are in a particular month based on the integer variable month, and store that value in the integer variable num_days. For example, if month is 8, num_days should be set to 31, since the eighth month, August, has 31 days. #Remember to account for zero-based indexing! month = 8 days_in_month = [31,28,31,30,31,30,31,31,30,31,30,31] # use list indexing to determine the number of days in month print(num_days) |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 3:24pm On Jul 27, 2020 |
#Quiz: Assign and Modify Variables #Now it's your turn to work with variables. The comments in this quiz (the lines that begin with #) have instructions for creating and modifying variables. After each comment write a line of code that implements the instruction. #Note that this code uses scientific notation to define large numbers. 4.445e8 is equal to 4.445 * 10 ** 8 which is equal to 444500000.0. # Write your function here. Make sure to use "population_density" as the name of the fucntion. so, the test below works. # test cases for your function Dont change anything below this comment. test1 = population_density(10, 1) expected_result1 = 10 print("expected result: {}, actual result: {}".format(expected_result1, test1)) test2 = population_density(864816, 121.4) expected_result2 = 7123.6902801 print("expected result: {}, actual result: {}".format(expected_result2, test2)) |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 3:08pm On Jul 27, 2020 |
#Note that this code uses scientific notation to define large numbers. 4.445e8 is equal to 4.445 * 10 ** 8 which is equal to 444500000.0. # The current volume of a water reservoir (in cubic metres) reservoir_volume = 4.445e8 # The amount of rainfall from a storm (in cubic metres) rainfall = 5e6 # decrease the rainfall variable by 10% to account for runoff # add the rainfall variable to the reservoir_volume variable # increase reservoir_volume by 5% to account for stormwater that flows into the reservoir in the days following the storm # decrease reservoir_volume by 5% to account for evaporation # subtract 2.5e5 cubic metres from reservoir_volume to account for water that's piped to arid regions. # print the new value of the reservoir_volume variable |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 3:01pm On Jul 27, 2020 |
#Quiz: Calculate #In this quiz you're going to do some calculations for a tiler. Two parts of a floor need tiling. One part is 9 tiles wide by 7 tiles long, the other is 5 tiles wide by 7 tiles long. Tiles come in packages of 6. #1. How many tiles are needed? #2. You buy 17 packages of tiles containing 6 tiles each. How many tiles will be left over? # Fill this in with an expression that calculates how many tiles are needed. print() # Fill this in with an expression that calculates how many tiles will be left over. print() |
Jokes Etc / Re: Watch: What Is Deodorant Used For?, See Funny Replies by nduprincekc(m): 2:36pm On Jul 27, 2020 |
#1. What is the length of the string variable verse? #2. What is the index of the first occurrence of the word 'and' in verse? #3. What is the index of the last occurrence of the word 'you' in verse? #4. What is the count of occurrences of the word 'you' in the verse? verse = "If you can keep your head when all about you\n Are losing theirs and blaming it on you,\nIf you can trust yourself when all men doubt you,\n But make allowance for their doubting too;\nIf you can wait and not be tired by waiting,\n Or being lied about, don’t deal in lies,\nOr being hated, don’t give way to hating,\n And yet don’t look too good, nor talk too wise:" print(verse) # Use the appropriate functions and methods to answer the questions above # Bonus: practice using .format() to output your answers in descriptive messages! |
Politics / Re: "I Left Only 52 Roads, Not 96" – Peter Obi Hits Back At Obiano by nduprincekc(m): 10:25pm On Jun 27, 2020 |
Nawao |
Programming / Re: Chronicle Of A Data Scientist/analyst by nduprincekc(m): 1:16am On Jun 20, 2020 |
Thanks |
Programming / Re: Learn Python With Kash by nduprincekc(m): 1:07am On Jun 20, 2020 |
Nice |
Sports / Re: Taiwo Awoniyi Suffers Concussion, Rushed To Hospital by nduprincekc(m): 3:46pm On Jun 16, 2020 |
1 Like 1 Share |
Sports / Re: Taiwo Awoniyi Suffers Concussion, Rushed To Hospital by nduprincekc(m): 1:05pm On Jun 15, 2020 |
lekki1444: Assume he swallowed his tongue what will happen sire? Please am just asking |
Politics / Re: Igbokwe: 2nd Niger Bridge Used For Dribbling South-east For 21 Years by nduprincekc(m): 2:46pm On Jun 06, 2020 |
""" This is the second task of our HNG intenship program. we are expected to output our name, id and language """ def code(): firstName = '[Emmanuel]' lastName = '[Nduaguba]' id = '[HNG-01522]' email = 'nduagubaemma@gmail.com' language = '[Python]' print('Hello World,this is', firstName, lastName ,'with HNGi7 ID', id, 'using', language, 'for stage 2 ',email) code() |
Technology Market / Re: The Xiaomi Thread Store by nduprincekc(m): 7:30pm On May 30, 2020 |
my new note 8 redmi battery no dey last guyhs plz i need help seriously |
Technology Market / My New Redmi Note Battery by nduprincekc(m): 11:03pm On May 29, 2020 |
my new redmi note battery does not last please. i need help seriously |
Phones / Re: The Xiaomi Thread. by nduprincekc(m): 3:24pm On May 28, 2020 |
abdsamad: Yesterday night it was 97 , this early morning it was 85 ... Something is wrong sir |
Phones / Re: The Xiaomi Thread. by nduprincekc(m): 3:23pm On May 28, 2020 |
fibonacci2526:
|
Phones / Re: The Xiaomi Thread. by nduprincekc(m): 3:06pm On May 28, 2020 |
My new redmi note 8 no dey last for battery guys |
Phones / Re: The Xiaomi Thread. by nduprincekc(m): 3:03pm On May 28, 2020 |
hardeycute:. Ok sir |
Phones / Re: The Xiaomi Thread. by nduprincekc(m): 3:01pm On May 28, 2020 |
froshroy:
|
Phones / Re: The Xiaomi Thread. by nduprincekc(m): 2:58pm On May 28, 2020 |
abdsamad: I don't understand |
(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (of 35 pages)
(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. 44 |