def octal_to_dec(n): # Function which is convert octal to decimal num = n; dec_value = 0; base = 1; # Initializing base value i.e 8^0 temp = num; while (temp): last_digit = temp % 10; temp = int(temp / 10); dec_value += last_digit * base; base = base * 8; return dec_value; #_____main______ octal_num=int(input("Please enter an octal (0 to 7) number: ")) print(octal_to_dec(octal_num));Output 1:Please enter an octal (0 to 7) number:5949Output 2:Please enter an octal (0 to 7) number:432282Output 3:Please enter an octal (0 to 7) number:2545711055

इन्हें भी देखें।

- while loop
- for loop
- nested loops
- loop control statements (Break, Continue, Pass)
- if statement
- if-else statement
- if-elif statement
- nested if statement
- range() function
- keywords
- Identifiers (names)
- Literals
- Operators
- punctuatorts

Python Programs के लिये यहाँ click करें।