Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdd89ef5

Browse files
committed
assig SIC
1 parent559ee1b commitdd89ef5

10 files changed

+18
-20
lines changed

‎SIC_assignment/1SetCreation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
prime_number= {2,3,5,7,11,13,17,19,23,29}
2+
print("Sprime numbers:",prime_number)
3+
print("Length of set:",len(prime_number))

‎SIC_assignment/Set_Operations.pyrenamed to‎SIC_assignment/2SetOperations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
intersection_set=A.intersection(B)
88
print("Intersection:",intersection_set)
99

10-
1110
difference_set=A.difference(B)
1211
print("Difference (A - B):",difference_set)

‎SIC_assignment/Dictionary_Creation.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# Dictionary mapping countries to capitals
2-
country_capitals= {
1+
Bhai= {
32
"India":"New Delhi",
43
"USA":"Washington D.C.",
54
"France":"Paris",
65
"Germany":"Berlin",
76
"Australia":"Canberra"
87
}
9-
10-
11-
print("Capital of France:",country_capitals["France"])
8+
print("Capital of France:",Bhai["France"])
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defprint_sorted_students(scores_dict):
22
sorted_students=sorted(scores_dict.items(),key=lambdax:x[1],reverse=True)
33
forname,scoreinsorted_students:
4-
print(f"Student:{name}, Score:{score}")
4+
print(f"{name} scored{score} marks!")
55

6-
student_scores= {"John":85,"Jane":90,"Doe":78,"Alice":92}
6+
student_scores= {"Raj":85,"Priya":90,"Amit":78,"Neha":92}
77
print_sorted_students(student_scores)

‎SIC_assignment/Dictionary_Update.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ def add_key_value_pair(d, key, value):
22
d[key]=value
33
returnd
44

5-
my_dict= {"India":"New Delhi","USA":"Washington D.C."}
6-
updated_dict=add_key_value_pair(my_dict,"Canada","Ottawa")
5+
my_dict= {"India":"New Delhi","USA":"Wash"}
6+
updated_dict=add_key_value_pair(my_dict,"Lucknow","UP")
7+
8+
9+
print("desh aur inke rajya name :-")
710
print(updated_dict)

‎SIC_assignment/Nested_Structures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ def map_students_to_scores(student_list):
22
return {name:scoreforname,scoreinstudent_list}
33

44

5-
students= [("John",85), ("Jane",90), ("Doe",78)]
5+
students= [("bhoot",21), ("rohan",35), ("Chandan",22)]
66
print(map_students_to_scores(students))

‎SIC_assignment/Set_Creation.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎SIC_assignment/Tuple_Unpacking.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
deftuple_sum_and_product(t):
2-
first_two_sum=t[0]+t[1]
3-
last_two_product=t[1]*t[2]
4-
returnfirst_two_sum,last_two_product
1+
defsumoftuple(t):
2+
first_sum=t[0]+t[1]
3+
last_product=t[1]*t[2]
4+
returnfirst_sum,last_product
55

66
test_tuple= (3,4,5)
7-
sum_result,product_result=tuple_sum_and_product(test_tuple)
7+
sum_result,product_result=sumoftuple(test_tuple)
88
print("Sum of first two:",sum_result)
99
print("Product of last two:",product_result)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp