Write a Python Program to Find First And Last Digit of a Number - LeetCode

preview_player
Показать описание
Hello Programmers, Welcome to my channel.

In this video you will learn about how to Write a Python Program to Find First And Last Digit of a Number

Python Scripts
======================

Python Functions Solved
==========================

Python Programs Solved
============================

Code
=============================

Keywords
=============================
#python #python3 #python_assignment #pythonprogramming #pythontutorial #pythonprojects #pythoncourse #pythonbaba #pythonforbeginners #pythonautomation #pythonbasic #pythonbeginners
Рекомендации по теме
Комментарии
Автор

Sadly, this only works for positive integers
but I found a better way

>convet num to string
>get first/last index of string
>convert first/last index to string

first_digit = int(str(number)[0])
last_digit = int(str(number)[-1])

aarav