id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
300 | figure - shows fleet that has been partially shot down figure - we can shoot aliensmaking larger bullets for testing you can test many features of the game simply by running the gamebut some features are tedious to test in the normal version of game for exampleit' lot of work to shoot down every alien on the screen mul... |
301 | repopulating the fleet one key feature of alien invasion is that the aliens are relentlessevery time the fleet is destroyeda new fleet should appear to make new fleet of aliens appear after fleet has been destroyedfirst check to see whether the group aliens is empty if it iswe call create_fleet(we'll perform this check... |
302 | ai_settingsscreenand shipso we need to update the call to update_bullets(in alien_invasion pyalien_ invasion py start the main loop for the game while truegf check_events(ai_settingsscreenshipbulletsship update(gf update_bullets(ai_settingsscreenshipaliensbulletsgf update_aliens(ai_settingsaliensgf update_screen(ai_set... |
303 | destroy existing bullets and create new fleet bullets empty(create_fleet(ai_settingsscreenshipalienswe've created new functioncheck_bullet_alien_collisions()to look for collisions between bullets and aliensand to respond appropriately if the entire fleet has been destroyed this keeps update_bullets(from growing too lon... |
304 | group the method looks for any member of the group that' collided with the sprite and stops looping through the group as soon as it finds one member that has collided with the sprite hereit loops through the group aliens and returns the first alien it finds that has collided with ship if no collisions occurspritecollid... |
305 | reset_stats(instead of directly in __init__(we'll call this method from __init__(so the statistics are set properly when the gamestats instance is first created ubut we'll also be able to call reset_stats(any time the player starts new game right now we have only one statisticships_leftthe value of which will change th... |
306 | """respond to ship being hit by alien ""decrement ships_left stats ships_left - empty the list of aliens and bullets aliens empty(bullets empty( create new fleet and center the ship create_fleet(ai_settingsscreenshipaliensship center_ship( pause sleep( def update_aliens(ai_settingsstatsscreenshipaliensbullets)--snip-lo... |
307 | game should pauseand new fleet should appear with the ship centered at the bottom of the screen again aliens that reach the bottom of the screen if an alien reaches the bottom of the screenwe'll respond the same way we do when an alien hits the ship add new function to perform this checkand call it from update_aliens()... |
308 | has used up all their shipsgame_ functions py def ship_hit(ai_settingsstatsscreenshipaliensbullets)"""respond to ship being hit by alien ""if stats ships_left decrement ships_left stats ships_left - --snip-pause sleep( elsestats game_active false most of ship_hit(is unchanged we've moved all of the existing code into a... |
309 | - game overusing your code from exercise - (page )keep track of the number of times the player misses the ball when they've missed the ball three timesend the game summary in this you learned how to add large number of identical elements to game by creating fleet of aliens you learned how to use nested loops to create ... |
310 | sc in this we'll finish the alien invasion game we'll add play button to start game on demand or to restart game once it ends we'll also change the game so it speeds up when the player moves up leveland we'll implement scoring system by the end of the you'll know enough to start writing games that increase in difficult... |
311 | in this section we'll add play button that appears before game begins and reappears when the game ends so the player can play again right now the game begins as soon as you run alien_invasion py let' start the game in an inactive state and then prompt the player to click play button to begin to do thisenter the followi... |
312 | text to the screen the __init__(method takes the parameters selfthe ai_settings and screen objectsand msgwhich contains the text for the button we set the button dimensions at vand then we set button_color to color the button' rect object bright green and set text_color to render the text in white at we prepare font at... |
313 | we'll use the button class to create play button because we need only one play buttonwe'll create the button directly in alien_invasion py as shown herealien_ invasion py --snip-from game_stats import gamestats from button import button --snip-def run_game()--snip-pygame display set_caption("alien invasion" make the pl... |
314 | starting the game to start new game when the player clicks playadd the following code to game_functions py to monitor mouse events over the buttongame_ functions py def check_events(ai_settingsscreenstatsplay_buttonshipbullets)"""respond to keypresses and mouse events ""for event in pygame event get()if event type =pyg... |
315 | alien_ invasion py start the main loop for the game while truegf check_events(ai_settingsscreenstatsplay_buttonshipbullets--snip-at this pointyou should be able to start and play full game when the game endsthe value of game_active should become false and the play button should reappear resetting the game the code we j... |
316 | to check_play_button()game_ functions py def check_events(ai_settingsscreenstatsplay_buttonshipaliensbullets)"""respond to keypresses and mouse events ""for event in pygame event get()if event type =pygame quit--snip-elif event type =pygame mousebuttondownmouse_xmouse_y pygame mouse get_pos( check_play_button(ai_settin... |
317 | we want the mouse cursor visible in order to begin playbut once play begins it only gets in the way to fix thiswe'll make it invisible once the game becomes activegame_ functions py def check_play_button(ai_settingsscreenstatsplay_buttonshipaliensbulletsmouse_xmouse_y)"""start new game when the player clicks play ""but... |
318 | in our current gameonce player shoots down the entire alien fleetthe player reaches new levelbut the game difficulty doesn' change let' liven things up bit and make the game more challenging by increasing the speed of the game each time player clears the screen modifying the speed settings we'll first reorganize the se... |
319 | fleet_direction of represents right- represents left self fleet_direction this method sets the initial values for the shipbulletand alien speeds we'll increase these speeds as the player progresses in the game and reset them each time the player starts new game we include fleet_direction in this method so the aliens al... |
320 | time you clear the screenthe game should speed up and become slightly more difficult if the game becomes too difficult too quicklydecrease the value of settings speedup_scaleor if the game isn' challenging enoughincrease the value slightly find sweet spot by ramping up the difficulty in reasonable amount of time the fi... |
321 | self ai_settings ai_settings self stats stats font settings for scoring information self text_color ( self font pygame font sysfont(none prepare the initial score image self prep_score(because scoreboard writes text to the screenwe begin by importing the pygame font module nextwe give __init__(the parameters ai_setting... |
322 | to display the scorewe'll create scoreboard instance in alien_invasion pyalien_ invasion py --snip-from game_stats import gamestats from scoreboard import scoreboard --snip-def run_game()--snip-create an instance to store game statistics and create scoreboard stats gamestats(ai_settingsu sb scoreboard(ai_settingsscreen... |
323 | now to assign point values to each alienupdating the score as aliens are shot down to write live score to the screenwe update the value of stats score whenever an alien is hitand then call prep_score(to update the score image but firstlet' determine how many points player gets each time they shoot down an aliensettings... |
324 | if collisionsstats score +ai_settings alien_points sb prep_score(--snip-we update the definition of check_bullet_alien_collisions(to include the stats and sb parameters so it can update the score and the scoreboard when bullet hits an alienpygame returns collisions dictionary we check whether the dictionary existsand i... |
325 | becomes key in the collisions dictionary the value associated with each bullet is list of aliens it has collided with we loop through the collisions dictionary to make sure we award points for each alien hitgame_ functions py def check_bullet_alien_collisions(ai_settingsscreenstatssbshipaliensbullets)--snip-if collisio... |
326 | alien point value by larger amount ( now when we increase the speed of the gamewe also increase the point value of each hit we use the int(function to increase the point value by whole integers to see the value of each alienadd print statement to the method increase_speed(in settingssettings py def increase_speed(self)... |
327 | high scores every player wants to beat game' high scoreso let' track and report high scores to give players something to work toward we'll store high scores in gamestatsgame_stats py def __init__(selfai_settings)--snip-high score should never be reset self high_score because the high score should never be resetwe initi... |
328 | high_score_str "{:,}format(high_scoreself high_score_image self font render(high_score_strtrueself text_colorself ai_settings bg_colorcenter the high score at the top of the screen self high_score_rect self high_score_image get_rect(self high_score_rect centerx self screen_rect centerx self high_score_rect top self sco... |
329 | scoreso it will be displayed as both the current and high score but when you start second gameyour high score should appear in the middle and your current score at the rightas shown in figure - figure - the high score is shown at the top center of the screen displaying the level to display the player' level in the game... |
330 | scoreboard py def prep_level(self)"""turn the level into rendered image ""self level_image self font render(str(self stats level)trueself text_colorself ai_settings bg_colorposition the level below the score self level_rect self level_image get_rect(self level_rect right self score_rect right self level_rect top self s... |
331 | stats reset_stats(stats game_active true reset the scoreboard images sb prep_score(sb prep_high_score(sb prep_level(empty the list of aliens and bullets aliens empty(bullets empty(--snip-the definition of check_play_button(needs the sb object to reset the scoreboard imageswe call prep_score()prep_high_score()and prep_l... |
332 | in some classic gamesthe scores have labelssuch as scorehigh scoreand level we've omitted these labels because the meaning of each number becomes clear once you've played the game to include these labelsadd them to the score strings just before the calls to font render(in scoreboard note displaying the number of ships ... |
333 | display here' the import statements and __init__()scoreboard py import pygame font from pygame sprite import group from ship import ship class scoreboard()""" class to report scoring information ""def __init__(selfai_settingsscreenstats)--snip-self prep_level(self prep_ships(--snip-because we're making group of shipswe... |
334 | prep_ships(when new game starts we do this in check_play_button(in game_functions pygame_ functions py def check_play_button(ai_settingsscreenstatssbplay_buttonshipaliensbulletsmouse_xmouse_y)"""start new game when the player clicks play ""button_clicked play_button rect collidepoint(mouse_xmouse_yif button_clicked and... |
335 | game_ functions py def check_aliens_bottom(ai_settingsscreenstatssbshipaliensbullets)"""check if any aliens have reached the bottom of the screen ""screen_rect screen get_rect(for alien in aliens sprites()if alien rect bottom >screen_rect bottomtreat this the same as if ship got hit ship_hit(ai_settingsscreenstatssbshi... |
336 | - all-time high scorethe high score is reset every time player closes and restarts alien invasion fix this by writing the high score to file before calling sys exit(and reading the high score in when initializing its value in gamestats - refactoringlook for functions and methods that are doing more than one taskand ref... |
337 | data isua li at ion |
338 | ge ne at ing data data visualization involves exploring data through visual representations it' closely associated with data miningwhich uses code to explore the patterns and connections in data set data set can be just small list of numbers that fits in one line of code or many gigabytes of data making beautiful repre... |
339 | matplotliba mathematical plotting library we'll use matplotlib to make simple plotssuch as line graphs and scatter plots after whichwe'll create more interesting data set based on the concept of random walk-- visualization generated from series of random decisions we'll also use package called pygalwhich focuses on cre... |
340 | you might need to use pip instead of pip when installing packages alsoif this command doesn' workyou might need to leave off the --user flag on windows on windowsyou'll first need to install visual studio go to windows com/click downloadsand look for visual studio communitywhich is free set of developer tools for windo... |
341 | let' plot simple line graph using matplotliband then customize it to create more informative visualization of our data we'll use the square number sequence as the data for the graph just provide matplotlib with the numbers as shown hereand matplotlib should do the restmpl_squares py import matplotlib pyplot as plt squa... |
342 | mpl_squares py import matplotlib pyplot as plt squares [ plt plot(squareslinewidth= set chart title and label axes plt title("square numbers"fontsize= plt xlabel("value"fontsize= plt ylabel("square of value"fontsize= set size of tick labels plt tick_params(axis='both'labelsize= plt show(the linewidth parameter at contr... |
343 | but now that we can read the chart betterwe see that the data is not plotted correctly notice at the end of the graph that the square of is shown as let' fix that when you give plot( sequence of numbersit assumes the first data point corresponds to an -coordinate value of but our first point corresponds to an -value of... |
344 | set with one set of styling options and then emphasize individual points by replotting them with different options to plot single pointuse the scatter(function pass the single (xyvalues of the point of interest to scatter()and it should plot those valuesscatter_ squares py import matplotlib pyplot as plt plt scatter( p... |
345 | to plot series of pointswe can pass scatter(separate lists of xand -valueslike thisscatter_ squares py import matplotlib pyplot as plt x_values [ y_values [ plt scatter(x_valuesy_valuess= set chart title and label axes --snip-the x_values list contains the numbers to be squaredand y_values contains the square of each n... |
346 | --snip-set the range for each axis plt axis([ ]plt show(we start with list of -values containing the numbers through nexta list comprehension generates the -values by looping through the -values (for in x_values)squaring each number ( ** )and storing the results in y_values we then pass the input and output lists to sc... |
347 | to change the color of the pointspass to scatter(with the name of color to useas shown hereplt scatter(x_valuesy_valuesc='red'edgecolor='none' = you can also define custom colors using the rgb color model to define colorpass the argument tuple with three decimal values (one each for redgreenand blue)using values betwee... |
348 | saving your plots automatically if you want your program to automatically save the plot to fileyou can replace the call to plt show(with call to plt savefig()plt savefig('squares_plot png'bbox_inches='tight'the first argument is filename for the plot imagewhich will be saved in the same directory as scatter_squares py ... |
349 | chance you might imagine random walk as the path an ant would take if it had lost its mind and took every step in random direction random walks have practical applications in naturephysicsbiologychemistryand economics for examplea pollen grain floating on drop of water moves across the surface of the water because it i... |
350 | decide which direction to go and how far to go in that direction x_direction choice([ - ]x_distance choice([ ]x_step x_direction x_distance y_direction choice([ - ]y_distance choice([ ]y_step y_direction y_distance reject moves that go nowhere if x_step = and y_step = continue calculate the next and values next_x self ... |
351 | plt show(we begin by importing pyplot and randomwalk we then create random walk and store it in rw umaking sure to call fill_walk(at we feed the walk' xand -values to scatter(and choose an appropriate dot size figure - shows the resulting plot with points (the images in this section omit matplotlib' viewerbut you'll co... |
352 | and pause with the viewer open when you close the vieweryou'll be asked whether you want to generate another walk answer yand you should be able to generate walks that stay near the starting pointthat wander off mostly in one directionthat have thin sections connecting larger groups of pointsand so on when you want to ... |
353 | plotting the starting and ending points in addition to coloring points to show their position along the walkit would be nice to see where each walk begins and ends to do sowe can plot the first and last points individually once the main series has been plotted we'll make the end points larger and color them differently... |
354 | let' remove the axes in this plot so they don' distract us from the path of each walk to turn the axes offuse this coderw_visual py --snip-while true--snip-plt scatter(rw x_values[- ]rw y_values[- ] ='red'edgecolors='none' = remove the axes plt axes(get_xaxis(set_visible(falseplt axes(get_yaxis(set_visible(falseplt sho... |
355 | altering the size to fill the screen visualization is much more effective at communicating patterns in data if it fits nicely on the screen to make the plotting window better fit your screenadjust the size of matplotlib' outputlike thisrw_visual py --snip-while truemake random walkand plot the points rw randomwalk(rw f... |
356 | - molecular motionmodify rw_visual py by replacing plt scatter(with plt plot(to simulate the path of pollen grain on the surface of drop of waterpass in the rw x_values and rw y_valuesand include linewidth argument use instead of , points - modified random walksin the class randomwalkx_step and y_step are generated fro... |
357 | install pygal with pip (if you haven' used pip yetsee "installing python packages with pipon page on linux and os xthis should be something likepip install --user pygal on windowsthis should bepython - pip install --user pygal you may need to use the command pip instead of pipand if the command still doesn' work you ma... |
358 | before creating visualization based on this classlet' roll print the resultsand check that the results look reasonabledie_visual py from die import die create die die(make some rollsand store results in list results [ for roll_num in range( )result die roll(results append(resultprint(resultsat we create an instance of ... |
359 | increase the number of simulated rolls to to analyze the rollswe create the empty list frequencies to store the number of times each value is rolled we loop through the possible values ( through in this caseat vcount how many times each number appears in results and then append this value to the frequencies list we the... |
360 | pygal generates charts with darker background than what you see here figure - simple bar chart created with pygal notice that pygal has made the chart interactivehover your cursor over any bar in the chart and you'll see the data associated with it this feature is particularly useful when plotting multiple data sets on... |
361 | frequency results count(valuefrequencies append(frequencyvisualize the results hist pygal bar( hist title "results of rolling two dice times hist x_labels [' '' '' '' '' '' '' '' '' '' '' 'hist x_title "resulthist y_title "frequency of resulthist add(' 'frequencieshist render_to_file('dice_visual svg'after creating two... |
362 | you roll pair of dice as you can seeyou're least likely to roll or and most likely to roll because there are six ways to roll namely and and and and and or and rolling dice of different sizes let' create six-sided die and ten-sided dieand see what happens when we roll them , timesdifferent_ dice py from die import die ... |
363 | our ability to use pygal to model the rolling of dice gives us considerable freedom in exploring this phenomenon in just minutes you can simulate tremendous number of rolls using large variety of dice try it yourse lf - automatic labelsmodify die py and dice_visual py by replacing the list we used to set the value of h... |
364 | in this you learned to generate data sets and create visualizations of that data you learned to create simple plots with matplotliband you saw how to use scatter plot to explore random walks you learned to create histogram with pygal and how to use histogram to explore the results of rolling dice of different sizes gen... |
365 | di in this you'll download data sets from online sources and create working visualizations of that data an incredible variety of data can be found onlinemuch of which hasn' been examined thoroughly the ability to analyze this data allows you to discover patterns and connections that no one else has found we'll access a... |
366 | and death valleycalifornia later in the we'll use the json module to access population data stored in the json format and use pygal to draw population map by country by the end of this you'll be prepared to work with different types and formats of data setsand you'll have deeper understanding of how to build complex vi... |
367 | working with in filename we then open the file and store the resulting file object in nextwe call csv reader(and pass it the file object as an argument to create reader object associated with that file we store the reader object in reader the csv module contains next(functionwhich returns the next line in the file when... |
368 | akdt max temperaturef mean temperaturef min temperaturef --snip- cloudcover events winddirdegrees here we see that the dates and their high temperatures are stored in columns and to explore this datawe'll process each row of data in sitka_weather_ - csv and extract the values with the indices and extracting and reading... |
369 | matplotlibhighs_lows py --snip-highs [for row in readeru high int(row[ ]highs append(highprint(highswe convert the strings to integers at before appending the temperatures to the list the result is list of daily highs in numerical format[ now let' create visualization of this data plotting data in temperature chart to ... |
370 | the datetime module let' add dates to our graph to make it more useful the first date from the weather data file is in the second row of the file, , , , , , , , , , ,--snip-the data will be read in as stringso we need way to convert the string 'to an object representing this date we can construct an object representing... |
371 | argument meaning % weekday namesuch as monday % month namesuch as january % monthas number ( to % day of the monthas number ( to % four-digit yearsuch as % two-digit yearsuch as % hourin -hour format ( to % hourin -hour format ( to % am or pm % minutes ( to % seconds ( to plotting dates knowing how to process the dates... |
372 | plt ylabel("temperature ( )"fontsize= plt tick_params(axis='both'which='major'labelsize= plt show(we create two empty lists to store the dates and high temperatures from the file we then convert the data containing the date information (row[ ]to datetime object and append it to dates we pass the dates and the high temp... |
373 | and we update the title of our plot to reflect the change in its content figure - shows the resulting plot figure - year' worth of data plotting second data series the reworked graph in figure - displays substantial amount of meaningful databut we can make it even more useful by including the low temperatures we need t... |
374 | fig plt figure(dpi= figsize=( )plt plot(dateshighsc='red' plt plot(dateslowsc='blue'format plot plt title("daily high and low temperatures "fontsize= --snip-at we add the empty list lows to hold low temperaturesand then we extract and store the low temperature for each datefrom the fourth position in each row (row[ ] a... |
375 | of is completely transparentand (the defaultis completely opaque by setting alpha to we make the red and blue plot lines appear lighter at we pass fill_between(the list dates for the -values and then the two -value series highs and lows the facecolor argument determines the color of the shaded regionand we give it low ... |
376 | the following outputtraceback (most recent call last)file "highs_lows py"line in high int(row[ ]valueerrorinvalid literal for int(with base 'the traceback tells us that python can' process the high temperature for one of the dates because it can' turn an empty string (''into an integer look through death_valley_ csv sh... |
377 | high and low temperature if any data is missingpython will raise valueerror and we handle it by printing an error message that includes the date of the missing data after printing the errorthe loop will continue processing the next row if all data for date is retrieved without errorthe else block will run and the data ... |
378 | - san franciscoare temperatures in san francisco more like temperatures in sitka or temperatures in death valleygenerate high-low temperature plot for san francisco and make comparison (you can download weather data for almost any location from enter location and date rangescroll to the bottom of the pageand find link ... |
379 | let' look at population_data json to see how we might begin to process the data in the filepopulation_ data json "country name""arab world""country code""arb""year"" ""value"" }"country name""arab world""country code""arb""year"" ""value"" }--snip-the file is basically one long python list each item is dictionary with ... |
380 | arab world caribbean small states east asia pacific (all income levels) --snip-zimbabwe not all of the data we captured includes exact country namesbut this is good start now we need to convert the data into format pygal can work with converting strings into numerical values every key and value in population_data json ... |
381 | can print full set of population values for the year with no errorsarab world caribbean small states east asia pacific (all income levels) --snip-zimbabwe each string was successfully converted to float and then to an integer now that these population values are stored in numerical formatwe can use them to make world p... |
382 | if name =country_namereturn code if the country wasn' foundreturn none return none print(get_country_code('andorra')print(get_country_code('united arab emirates')print(get_country_code('afghanistan')we pass get_country_code(the name of the country and store it in the parameter country_name we then loop through the code... |
383 | al dz --snip-error yemenrep zm zw the errors come from two sources firstnot all the classifications in the data set are by countrysome population statistics are for regions (arab worldand economic groups (all income levelssecondsome of the statistics use different system for full names of countries (yemenrep instead of... |
384 | we now know how to make map with colored areasa keyand neat labels let' add data to our map to show information about country plotting numerical data on world map to practice plotting numerical data on mapcreate map showing the populations of the three countries in north americana_ populations py import pygal wm pygal ... |
385 | this map is interactiveif you hover over each countryyou'll see its population let' add more data to our map plotting complete population map to plot population numbers for the rest of the countrieswe have to convert the country data we processed earlier into the dictionary format pygal expectswhich is two-letter count... |
386 | if codecc_populations[codepopulation wm pygal worldmap(wm title 'world population in by countryx wm add(' 'cc_populationswm render_to_file('world_population svg'we first import pygal at we create an empty dictionary to store country codes and populations in the format pygal expects at we build the cc_populations dictio... |
387 | because china and india are more heavily populated than other countriesthe map shows little contrast china and india are each home to over billion peoplewhereas the next most populous country is the united states with approximately million people instead of plotting all countries as one grouplet' separate the countries... |
388 | million people countries with between million and billion peopleand two outlier countries with over billion this seems like an even enough split for an informative map figure - shows the resulting map figure - the world' population shown in three different groups now three different colors help us see the distinctions ... |
389 | if pop --snip- wm_style rotatestyle('# ' wm pygal worldmap(style=wm_stylewm title 'world population in by country--snip-pygal styles are stored in the style module from which we import the style rotatestyle this class takes one argumentan rgb color in hex format pygal then chooses colors for each of the groups based on... |
390 | are easy to distinguish lightening the color theme pygal tends to use dark themes by default for the purposes of printingi've lightened the style of my charts using lightcolorizedstyle this class changes the overall theme of the chartincluding the background and labels as well as the individual country colors to use it... |
391 | - all countrieson the population maps we made in this sectionour program couldn' automatically find two-letter codes for about countries work out which countries are missing codesand look through the countries dictionary for the codes add an ifelif block to get_country_code(so it returns the correct country code values... |
392 | process almost any data you want to analyze most online data sets can be downloaded in either or both of these formats from working with these formatsyou'll be able to learn other data formats as well in the next you'll write programs that automatically gather their own data from online sourcesand then you'll create vi... |
393 | working with apis in this you'll learn how to write self-contained program to generate visualization based on data that it retrieves your program will use web application programming interface (apito automatically request specific information from website rather than entire pages it will then use that information to ge... |
394 | web api is part of website designed to interact with programs that use very specific urls to request certain information this kind of request is called an api call the requested data will be returned in an easily processed formatsuch as json or csv most apps that rely on external data sourcessuch as apps that integrate... |
395 | information only on repositories that have python as the primary language the final part&sort=starssorts the projects by the number of stars they've been given the following snippet shows the first few lines of the response you can see from the response that this url is not intended to be entered by humans "total_count... |
396 | response_dict json(process results print(response_dict keys()at we import the requests module at we store the url of the api calland then we use requests to make the call we call get(and pass it the urland we store the response object in the variable the response object has an attribute called status_codewhich tells us... |
397 | repo_dict repo_dicts[ print("\nkeys:"len(repo_dict) for key in sorted(repo_dict keys())print(keyat we print the value associated with 'total_count'which represents the total number of python repositories on github the value associated with 'itemsis list containing number of dictionarieseach of which contains data about... |
398 | print('repository:'repo_dict['html_url'] print('created:'repo_dict['created_at']print('updated:'repo_dict['updated_at']print('description:'repo_dict['description']here we print out the values for number of keys from the first repository' dictionary at we print the name of the project an entire dictionary represents the... |
399 | for repo_dict in repo_dictsprint('\nname:'repo_dict['name']print('owner:'repo_dict['owner']['login']print('stars:'repo_dict['stargazers_count']print('repository:'repo_dict['html_url']print('description:'repo_dict['description']we print an introductory message at at we loop through all the dictionaries in repo_dicts ins... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.