Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Python codes

The document contains a series of Python scripts that convert numbers between different numeral systems (binary, octal, hexadecimal) and perform basic operations like finding the smallest and largest of three numbers, calculating factorials, and displaying calendars for specific years and months. Each script prompts the user for input and outputs the corresponding result. The examples demonstrate the functionality of each script with sample inputs and outputs.

Uploaded by

sayoojps369
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Python codes

The document contains a series of Python scripts that convert numbers between different numeral systems (binary, octal, hexadecimal) and perform basic operations like finding the smallest and largest of three numbers, calculating factorials, and displaying calendars for specific years and months. Each script prompts the user for input and outputs the corresponding result. The examples demonstrate the functionality of each script with sample inputs and outputs.

Uploaded by

sayoojps369
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Welcome hello.py X I Microsoft Edge.

Ink

hello.py >...
1 d=int (input ("Enter the decimal number:"))
2 print(d, "in binary form is", bin(d))
3 print (d, "in octogonal form is",oct (d) )
print (d, "in hexogonal form is", hex(d))

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORIS

PS C:\Users\Aditya\OneDrive\ Desktop> & C:/Users/Aditya/AppData/Local/Microsoft/WindowsApps/python3.11. exe c:/Users/ Aditya/OneDr


ive/Desktop/hello . py
Enter the decimal number:110
110 in binary form is b1101110
11e in octogonal form is o156
110 in hexogonal form is x6e
PS C:\Users \Aditya\OneDrive\Desktop>
Welcome hello.py X E Microsoft Edge.Ink

hello.py >...
b=eval (input ("Enter the binary number:"))
2 print (b, "in hexagonal form is", hex(b))
3 print (b, "in octagonal form is", oct (b))

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORTS Python + D AX

PS C:\Users\Aditya\OneDrive\Desktop> & C:/Users/Aditya/AppData/Local/Microsoft/WindowsApps/python3.11. exe c:/Users/Aditya/0neDr


ive/Desktop/hello. py
Enter the binary number:0b101010
42 in hexagonal form is ex2a
42 in octagonal form is Bo52
PS C:\Users\Aditya\OneDrive\Desktop>
Welcome & hello.pPy X
E Microsoft Edgelnk
hello.py>...
1 h=eval(input ("Enter the hexagonal number:"))
2 print (h, "in binary form is", bin (h))
3 print (h, "in octagonal form is", oct (h) )

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORTS Python+ 0 . a x


PS C:\Users\Aditya\OneDrive\Desktop> & C:/Users/Aditya/AppData/Local/Microsoft/WindowsSApps/python3.11.exe c:/Users/Aditya/OneDr
ive/Desktop/hello. py
Enter the hexagonal number:0xa3
163 in binary form is eb10100011
163 in octagonal form is e0243
PS C:\Users\Aditya \OneDrive\Desktop>
Welcome hello.py X E Microsoft Edge.Ink

hello.py >...
X=eval(input ("Enter the octoganal number:"))
2 print (x, "in binary form is",bin(x))
3 print (x, "in hexagonal form is",hex(x))

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORTS Python + 0 a X


PS C:\Users\Aditya\OneDrive\Desktop> & C:/Users/Aditya/AppData/Local/Microsoft/WindowsApps/python3.11. exe c:/Users/Aditya/OneDr
ive/Desktop/hello. py
Enter the octoganal number: 12
12 in binary form is eb1100
12 in hexagonal form is Gxc
PS C:\Users\Aditya\OneDrive\Desktop>
Welcome hello.py X E Microsoft Edge.lnk
" hello.py.
x=input(" Enter the string:")
l=len(x)
3 print (" The length of",x, "is", l)

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORIS

PS C:\Users\Aditya\OneDrive\Desktop> & C:/Users/Aditya/AppData/Local/Microsoft/WindowSApps/python3.11. exe c: /Users/Aditya/OneDr


ive/Desktop/hello. py
Enter the string: goodmorning
The length of goodmorning is 11
PS C:\Users \Aditya\OneDrive\Desktop>
Welcome hello.py X Microsoft Edge.Ink
hello.py >...
1 a=int (input("Enter a number:"))
2 b=int(input("Enter a number:") )
3 c=int (input ("Enter a number:") )
4 print ("The smallest number is",min (a,b, c))
5 print ("The largest number is", max(a,b, c))

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORTS E) Python + 0 X


PS C:\Users\Aditya\OneDrive\Desktop> & C:/Users/Aditya/AppData/Local/Microsoft/WindowSApps/python3.11.exe c:/Users/Aditya/OneDr
ive/Desktop/hello . py
Enter a number:4
Enter a number:6
Enter a number:9
The smallest number is 4
The largest number is 9
PS C:\Users\Aditya\OneDrive\Desktop>
4 Welcome + hello.py X E Microsoft Edge.Ink
" hello.py>.
1 import math
2 X=int (input ("Enter a number:") )
3 print ("The factorial of", x, "is",math.factorial(x))

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORTS Python + 0 . X


PS C:\Users\Aditya\OneDrive\Desktop> & C:/Users/Aditya/AppData/Local/Microsoft/WindowsApps/python3.11. exe c:/Users/Aditya/0neDr
ive/Desktop/hello . py
Enter a number:5
The factorial of 5 is 120
PS C:\Users\Aditya\OneDrive\Desktop>
Welcome X hello.py X E Microsoft Edge.Ink

hello.py >...
1 import math
x=int(input("Enter a number:"))
3 p=math.factorial (x)
4 print("The length of the factorial of",x, "is", len (str (p) ))
5

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORIS

PS C:\Users\Aditya \OneDrive\Desktop> & C:/Users/Aditya/AppData/ Local/Microsoft/WindowsApps/python3.11. exe c:/Users/Aditya/0neDr


ive/Desktop/hello. py
Enter a number:5
The length of the factorial of5 is 3
PS C:\Users\Aditya\OneDrive\Desktop>
Welcome hello.py E Microsoft Edge.Ink
" hello.py >...
1 import calendar
2 y=int (input ("Enter the year:"))
3 print ("The calender of",y, "is", calendar. calendar (y))

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORTS

Enter the year:2003


The calender of 2003 is 2003

January February March


Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 5 1 2 1 2
6 7 8 9 10 11 12 3 4 5 6 7 89 3 456 7 8 9
13 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16
20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23
27 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30
31

April May June


Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
Welcome hello.py X E Microsoft Edge.Ink
hello.py >...
import calendar
2 y=int(input ("Enter the year:"))
3 m=int(input("Enter the month:"))
print ("The calender is", calendar . month (y,m) )

PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL PORIS Python + M a X


PS C:\Users\Aditya\OneDrive\Desktop> & C:/Users/Aditya/AppData/ Local/Microsoft/WindowsApps/python3.11.exe C:/Users/Aditya/OneDr
ive/Desktop/hello. py
Enter the year:2003
Enter the month:2
The calender is February 2003
Mo Tu We Th Fr Sa Su
1 2
3 45 6 7 89
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28

You might also like