u/Ill-Break727

python beginner ; question was write program to enter marks of 3 subjects from user and store them in a dict.start with an empty dict and add one by one .use subject name as key and marks as value . so i have written this code any opinion how can improve this code ,need suggestions.

students={}
a=float(input("enter marks of chem"))
students.update({"chem": a})
b=float(input("enter marks of maths"))
students.update({"maths":b})
c=float(input("enter marks of phy"))
students.update({"phy": c})
print(students)
reddit.com
u/Ill-Break727 — 2 days ago

i have recently started learning python and i have done conditional identitites , and i have wriitn a program to find gretest of 3 numbers which are given as input . and i have seen every case , if u have some suggestions for improvemnet u are welcome , plz help i am just learning.

a=int(input("enter number1:"))
b=int(input("enter number2:"))
c=int(input("enter number3:"))
if(a>b and a>c):
    ans="number 1"
elif(b>a and b>c):
    ans="number 2"    
elif(c>a and c>b):
    ans="number 3"
elif(a==b==c):
    ans="all three are same"
elif(a==b!=c and a>c):
    ans="a nd b are same anfd greater than c"
elif(b==c!=a and b>a):
    ans="b nd c are same and greater than a"
else:
    ans="a nd c are same greater than b"    
print("the greatest number is :", ans)
reddit.com
u/Ill-Break727 — 3 days ago