Mid2 25th_Squaring_Numbers_Dictionary

 num=int(input("Enter the number: "))

d1={x:x**2 for x in range (1,num+1)}
print(d1)
#output:
Enter the number: 5 {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

Comments

Popular posts from this blog

JAVA Lab Programs

HANGMAN GAME

WD 22. StylingLinks&Buttons