|
| 1 | +# -------------- |
| 2 | +# Code starts here |
| 3 | + |
| 4 | +# Create the lists |
| 5 | +class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] |
| 6 | +class_2=['Hilary Mason','Carla Gentry','Corinna Cortes'] |
| 7 | +# Concatenate both the strings |
| 8 | +new_class=class_1+class_2 |
| 9 | + |
| 10 | +# Append the list |
| 11 | +new_class.append('Peter Warden') |
| 12 | + |
| 13 | +# Print updated list |
| 14 | +print(new_class) |
| 15 | + |
| 16 | +# Remove the element from the list |
| 17 | +new_class.remove('Carla Gentry') |
| 18 | +# Print the list |
| 19 | +print(new_class) |
| 20 | + |
| 21 | + |
| 22 | +# Create the Dictionary |
| 23 | +courses={"Math":65,"English":70,"History":80,"French":70,"Science":60} |
| 24 | +total=sum(courses.values()) |
| 25 | +print(total) |
| 26 | +percentage=(total/500)*100 |
| 27 | +print(percentage) |
| 28 | + |
| 29 | +# Slice the dict and stores the all subjects marks in variable |
| 30 | + |
| 31 | + |
| 32 | +# Store the all the subject in one variable `Total` |
| 33 | + |
| 34 | +# Print the total |
| 35 | + |
| 36 | +# Insert percentage formula |
| 37 | + |
| 38 | +# Print the percentage |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +# Create the Dictionary |
| 44 | + |
| 45 | +mathematics={"Geoffrey Hinton":78,"Andrew Ng":95,"Sebastian Raschka":65,"Yoshua Benjio":50,"Hilary Mason":70,"Corinna Cortes":66,"Peter Warden":75} |
| 46 | + |
| 47 | +topper=max(mathematics,key=mathematics.get) |
| 48 | +first_name=topper.split()[0] |
| 49 | +last_name=topper.split()[1] |
| 50 | + |
| 51 | +full_name =last_name+" "+first_name |
| 52 | +certificate_name=full_name.upper() |
| 53 | +print(certificate_name) |
| 54 | +# Given string |
| 55 | + |
| 56 | + |
| 57 | +# Create variable first_name |
| 58 | + |
| 59 | +# Create variable Last_name and store last two element in the list |
| 60 | + |
| 61 | +# Concatenate the string |
| 62 | + |
| 63 | +# print the full_name |
| 64 | + |
| 65 | +# print the name in upper case |
| 66 | + |
| 67 | +# Code ends here |
| 68 | + |
| 69 | + |
0 commit comments