f-strings in Python | Python Tutorial - Day #28

Поділитися
Вставка
  • Опубліковано 11 вер 2024
  • Python is one of the most demanded programming languages in the job market. Surprisingly, it is equally easy to learn and master Python. This python tutorial for absolute beginners in Hindi series will focus on teaching you python concepts from the ground up.
    Access the Playlist: • Python for Beginners (...
    Link to the Repl: replit.com/@co...
    Join Replit the browser-based IDE used in this course - join.replit.co...
    ►Checkout my English channel here: / @programmingwithharry
    ►Instagram: codewithharry
    python, C, C++, Java, JavaScript and Other Cheetsheets [++]:
    Playlist: • Coding CheatSheets 🧾 b...
    ►Learn in One Video[++]:
    Python[15 Hr]: • Python Tutorial For Be...
    Python Advance[3.5 Hr]: • Python Programming Cou...
    Python[1 Hr]: • Learn Python In Hindi ...
    Python[2 Hr]: • Python Tutorial In Hin...
    Python[15 Min]: • 15 Minute Python Tutor...
    JavaScript[1 Hr]: • JavaScript Tutorial
    C[1.3 Hr]- • C Programming Tutorial...
    php[1 Hr]: • Learn Php In One Video...
    php[2.3 Hr]: • Php Tutorial for Begin...
    php[Project]- • Login And Registration...
    HTML[30 Min]: • HTML 5 Tutorial For Be...
    CSS[8.5 Hr]: • CSS Tutorial In Hindi ...
    CSS[1.4 Hr]: • CSS 3 Tutorial For Beg...
    Wordpress[3.2 Hr]: • How To Make a WordPres...
    Angular[2 Hr]: • Angular Tutorial in Hindi
    Java[2.3 Hr]: • Java tutorial in hindi 🔥
    Web Scraping[1 Hr]: • Web Scraping Tutorial ...
    MongoDB[2 Hr]: • MongoDb Tutorial For B...
    Numpy[1 Hr]: • Numpy Tutorial in Hindi
    Android Dev[12 Hr]- • Android Development Tu...
    Linux[1 Hr]: • Linux Tutorial For Beg...
    JQuery[1.1 Hr]: • jQuery Tutorial For Be...
    Git and GitHub[1.1 Hr]: • Git & GitHub Tutorial ...
    ►Complete course [playlist]:
    React: • React Js Tutorials in ...
    Python- • Python Tutorials For A...
    OOP Python- • Object Oriented Progra...
    Java: • Java Tutorials For Beg...
    JavaScript- • JavaScript Tutorials I...
    PHP- • PHP Tutorials in Hindi
    C- • C Language Tutorials I...
    C++- • C++ Tutorials In Hindi
    Git & GitHub- • Git and GitHub Tutoria...
    Android Dev- • Android Development Tu...
    Python GUI- • Python GUI: Tkinter Tu...
    Web Development- • Web Development Tutori...
    Python Django: • Python Django Tutorial...
    Projects Using HTML, CSS & Javascript- • Projects Using HTML, C...
    Data Structure and Algo: • Data Structures and Al...
    Follow Me On Social Media
    ►Website (created using Django Rest & Angular): www.codewithha...
    ►Facebook: / codewithharry
    ►Instagram: / codewithharry
    Twitter: / codewithharry
    Comment "#HarryBhai" if you read this 😉😉

КОМЕНТАРІ • 438

  • @CodeWithHarry
    @CodeWithHarry  Рік тому +371

    🎉Merry Christmas to all python learners🎉

  • @khizrshaikh9902
    @khizrshaikh9902 Рік тому +25

    7:46
    You can print it as it is without writing f before double quotes like this:
    print("We use f-strings like this: Hey my name is {name} and I am from {country}")
    The output will be same as:
    print(f"We use f-strings like this: Hey my name is {{name}} and I am from {{country}}")

    • @rolitiwari8802
      @rolitiwari8802 Рік тому +2

      Yeah exactly bro.

    • @Shrenkstav
      @Shrenkstav 6 місяців тому +2

      Yes you are right but Harry is trying to show that how to print along with curly brackets while using f-strings.😃

  • @debasishbesra2901
    @debasishbesra2901 Рік тому +20

    Day6 of #100DaysOfCode. Today in this video 28, I learned about string formatting in Python using the format method and f-strings. The format method allows for more precise control over the formatting, such as specifying the number of decimal places. F-strings, introduced in PEP 498, provide a convenient way to embed Python expressions directly inside string literals for formatting. By prefixing a string with 'f', it becomes an f-string, making it easier to interpolate variables and expressions.
    Thank You Harry Bhaiya.

    • @aryyann05
      @aryyann05 Місяць тому

      bro did you complete the course or not?

  • @Vishavpreet123
    @Vishavpreet123 Рік тому +38

    "This Python Course is Helpful"
    -Who remember This Line of Harrry Sir

  • @user-hg1qi5xv5g
    @user-hg1qi5xv5g Рік тому +9

    7:37 But Harry Bhai, if we want to print the string as it is without replacing the identifiers with corresponding values, we could simply remove that *"f"* before the string which will turn the f-string into a normal string

    • @abhimanyukarkara4218
      @abhimanyukarkara4218 11 місяців тому

      I thought of the same

    • @rushexxoff
      @rushexxoff 10 місяців тому +1

      but in real programs you have to use f string generally with those {} brackets in use also so that is why it is helpful

  • @Atharva-Shinde
    @Atharva-Shinde 3 місяці тому +3

    7:43
    to show as it is just remove f
    print(f"hey my name is {name} and i am form {country}")
    like this
    print("hey my name is {name} and i am form {country}")

  • @paulaneesh7
    @paulaneesh7 Рік тому +20

    f-strings are quite like Template Literals of JavaScript

  • @tajinder715
    @tajinder715 Рік тому +29

    whoooooooooooooooo ⚜

  • @Subanbanu_Pathan
    @Subanbanu_Pathan Рік тому +4

    Jo sab log paise lekar bhi nahi sikhte
    Vo Harry Bhai free me sikha rahe he
    Keep it harry Bhai
    And guys please share harry bhai's chanale as well as posible.

  • @FaceSenseAustralia
    @FaceSenseAustralia Рік тому +10

    Practice Questions for this exercise:
    1. Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old.
    2. Write a program that calculates the area of a rectangle. Prompt the user for the length and width, then display the result using an f-string.
    3. Develop a simple currency converter program. Ask the user for an amount in USD and convert it to euros using a fixed conversion rate. Display the result using an f-string.
    thanks,
    faceSense

    • @rejuantamim6939
      @rejuantamim6939 10 місяців тому +1

      where i can get more problems like these?

    • @Top.Trending2
      @Top.Trending2 3 місяці тому

      You can provide solution???

    • @navneetpathrabe9484
      @navneetpathrabe9484 3 місяці тому

      1.Answer
      name = input("Enter your name: ")
      age = int(input("Enter your age: "))
      print(f"{name} will turn 100 years in {100 - age}")
      base = float(input("Enter base: "))
      height = float(input("Enter height: "))
      Area_Of_Rectangle = base * height
      print(f"Area of rectangle is: {Area_Of_Rectangle} ")
      dollar_amount = float(input("Enter amount in dollars: "))
      conversion_rate = 0.92
      euro_amount = dollar_amount * conversion_rate
      print(f"The converted amount is: €{euro_amount:2f}")

    • @minahiljilani5042
      @minahiljilani5042 3 місяці тому

      @@navneetpathrabe9484 hlo i want to print my name and my frnd name for 3 time if it above three time then loop will b terminated how i can solv

  • @profittohoga4078
    @profittohoga4078 Місяць тому +1

    I listened about this channel from a multi millionair stock trader of DELHI. then i seached this. and by GOD's grace i recalled my old days of 2003 when i learned my C, C++, C# from NIIT.

  • @proudtobeindian1894
    @proudtobeindian1894 Рік тому +9

    #Day28
    #100DaysOfCode
    No day missed yet.

  • @nishantchaudhary6361
    @nishantchaudhary6361 Рік тому +3

    question = ["Which country has largest army in the world ?" ,"Which country has fastest growing economy in the world","Which country has maximum number of time zones? "]
    answer = ["China","India","Russia"]
    que1 = print(question[0])
    ans1 = input()
    if ans1 == answer[0] :
    print("Your answer is correct you have won 10,00,000 rupees")
    que2 = print(question[1])
    ans2 = input()
    if ans2 == answer[1]:
    print("Your answer is correct you won 1,00,00,000 rupees")
    que3 = print(question[2])
    ans3 = input()
    if ans3 == answer[2]:
    print("You won the game and you earn 7,00,00,000 rupees")
    else :
    print("Sorry you loss the game")
    else:
    print("Sorry you have earn zero rupees and you disqualified ")

    else:
    print("Sorry you have earn zero rupees and you disqualified ")

  • @anonymous-ss8yc
    @anonymous-ss8yc Рік тому +3

    Thankyou sir... I'm doing this course in April and my aim is to complete 10 videos everyday to get this course done in 10 days... it's the 3rd day and I'm just 2 videos away from today's goal... thank you so much sir this course is so helpful and I can imagine how much I will be changed after the completion of this course regarding my programming skills...again thank you ❤️❤️

    • @PHros
      @PHros Рік тому

      Mera bhi aisa same goal tha lekin ab me 20-30 aik din me kar raha hoon

    • @anonymous-ss8yc
      @anonymous-ss8yc Рік тому

      @@PHros good bro

    • @TopRTelugu
      @TopRTelugu Рік тому

      finished?

    • @anonymous-ss8yc
      @anonymous-ss8yc Рік тому

      @@TopRTelugu unfortunately no bro.. i was busy in doing college things.. I'll continue soon after my sessionals get over.. it's a vast thing and so it is important to learn all modules separately.. first build basic understanding of all modules and then take lectures and then practice for better results.. reply on this comment when you complete the whole course.. good luck

  • @abhinav5786
    @abhinav5786 Рік тому +9

    Present sir 😁
    After a trip of 1 week I got 7 backlogs in this program....
    Backlog 4/7 completed

  • @vlog-edit06
    @vlog-edit06 Місяць тому +1

    intresting

  • @fact45.
    @fact45. Рік тому +1

    a=int(input("enter the hour"))
    if a==0 and a

  • @biswajeet9826
    @biswajeet9826 2 місяці тому

    One of the most Underrated Channels out there!!

  • @shahidaslam9968
    @shahidaslam9968 Рік тому +1

    Harry sir please make a video about ChatGPT. How to use ChatGPT for earning purpose

  • @jatinbhatt2222
    @jatinbhatt2222 Рік тому +5

    Present Sir on Day-28 ✋✋

  • @codinghub_IITG
    @codinghub_IITG 3 місяці тому +1

    Day 28 done ✅

  • @jaiminbariya8830
    @jaiminbariya8830 Рік тому +1

    #Harrybhai
    One day I'll definitely meet you bhai 🤘

  • @vashisththakar2695
    @vashisththakar2695 Місяць тому +1

    Day -28 Done

  • @shaon1412
    @shaon1412 Рік тому +5

    Day #17 of asking to make a discord server.

  • @HardikPareta
    @HardikPareta 3 місяці тому +1

    00:01 Python provides string formatting to place variables inside strings conveniently.
    01:07 Using f-strings to format strings in Python.
    02:16 f-strings in Python for easy and convenient string formatting
    03:08 Python f-strings allow easy string formatting with variables.
    04:10 Formatting floating point numbers with f-strings.
    05:24 F-strings allow easy formatting of strings with variables
    06:37 Using f-strings to insert variables into strings
    07:36 Using double curly brackets to display curly brackets in f-strings.
    Crafted by Merlin AI.

  • @arohi_303
    @arohi_303 6 днів тому +1

    Day 28✨

  • @Abhinaw_singh3549
    @Abhinaw_singh3549 Рік тому +1

    merry Christmas harry bhai🎅🎅

  • @statusmaster5759
    @statusmaster5759 Рік тому +1

    Hello Bhai mera question ye h ki majority mere friends k pss window laptop h... Me MacBook lena chahta hu but dikkat ye h ki window and MacBook me connectivity me issues naa aaye kahi data share yaa kuch orr process me 🤔🤔🤔 plzz bhai is topic par video bana do and sare MacBook ko compare karke konsa kiske liye sahi rahega bataiye 🙏🙏🙏

  • @absism34
    @absism34 Рік тому +1

    Just used f strings in previous exercise

  • @KoushikDas2005
    @KoushikDas2005 Рік тому +1

    #Day28
    #Present
    #CodeWithHarry
    #PythonChallenge
    Watching after 1 day
    ...was busy because of school exam preparation.

  • @RajNamdev_19
    @RajNamdev_19 11 місяців тому +1

    LOVE YOU HARRY BHAI❤

  • @FunFACT12331
    @FunFACT12331 8 місяців тому +1

    day 28 completado stoico

  • @exo-cs457agent_G1
    @exo-cs457agent_G1 Рік тому +1

    Best topic fstrings
    The thing I want in c++ so much

  • @Daily_dose_motivation29
    @Daily_dose_motivation29 Рік тому +1

    Day 28 🔥

  • @MahadKhan804
    @MahadKhan804 Рік тому +9

    Imagine getting ultimate course Web development 2023🤦🏻🥰

  • @siddhivinayaknaik9224
    @siddhivinayaknaik9224 Рік тому +1

    How To code in python ATM Machine ??

  • @UnderGamer_Official
    @UnderGamer_Official Рік тому

    Harry bhaiii please kivymd ka tutorial

  • @InnovativeCoders
    @InnovativeCoders Рік тому

    Great Going Coding Ka Rang Chad Gaya He Ekdum

  • @UnderGamer_Official
    @UnderGamer_Official Рік тому

    Sir please kivy & kivymd tutorial

  • @Vignesh-y4j
    @Vignesh-y4j Місяць тому +1

    28th one!!

  • @tusharkaushik5460
    @tusharkaushik5460 Рік тому +1

    Please make a course on unity too

    • @anonymousbruh9246
      @anonymousbruh9246 Рік тому

      BRo he is mainly Focused on web dev and high level programming languages. Check out bRackeyes course on yt

  • @MuhammadRafay-we9nc
    @MuhammadRafay-we9nc 5 місяців тому

    Python is best programming language

  • @CoderzGaming093
    @CoderzGaming093 Рік тому +1

    #day28 merry Christmas harry bhai🎅🎅

  • @mayanksinghdobal3534
    @mayanksinghdobal3534 2 місяці тому

    Sir still old method of string formatting is used. Is it important ?

  • @thatcoolkid370
    @thatcoolkid370 Рік тому

    Day #28 in 100DaysOfCode. Thanks, harry bhai for this Christmas gift(100DaysOfCode).

  • @biswajeet9826
    @biswajeet9826 2 місяці тому

    You deserve the best in Life!!

  • @ArihantJain-Qwertuhh
    @ArihantJain-Qwertuhh 3 місяці тому

    It is in the JS also but by string literals name

  • @shivamchaudhary8592
    @shivamchaudhary8592 Рік тому +1

    #Day28 Present Sir

  • @mdsohanurrahmanhridoy1343
    @mdsohanurrahmanhridoy1343 Рік тому +1

    Completed day#28 challenge...😍

  • @priyanshugupta3816
    @priyanshugupta3816 Рік тому

    Bhaiya do baar curly braces na dekar f ko hata dene se hi toh ho jayega. Fir 2 baar curly braces q?

  • @maliksohailanwar596
    @maliksohailanwar596 Рік тому

    #harryBhai is course me hm jarvaiz type kch bnayn gy. At the end ? 🤔🤔🤔

  • @Aditya_Vyas
    @Aditya_Vyas Рік тому +1

    Day 28 of Coding. Present Sir.

  • @kartiksandhu2957
    @kartiksandhu2957 Місяць тому +1

    Harry bhai ye program run n ho rha hai Mera help kro do

  • @90sbollywoodhindi
    @90sbollywoodhindi Рік тому

    harry bhai turtle module bhi sikhaoge kya??

  • @shubhampethe542
    @shubhampethe542 Рік тому

    Please start the data science course.

  • @mansigupta3829
    @mansigupta3829 9 місяців тому +1

    Guys just a question are curly brackets necessary for f string?

  • @cocshorts2620
    @cocshorts2620 9 днів тому

    day 28 done

  • @freekakhabri
    @freekakhabri Місяць тому +1

    day 28 present sir

  • @prof.coffee5326
    @prof.coffee5326 Рік тому +1

    Sir please tell us what is problem in this code"
    a = 4
    print("%a"%a)
    print("%c"%a)
    print("%d"%a)
    print("%e"%a)
    print("%f"%a)
    print("%g"%a)"

  • @simple3688
    @simple3688 Рік тому +1

    💖 Merry ⛄ Christmas 💖⛄ Bro 😘

  • @AkashSingh-xf6bd
    @AkashSingh-xf6bd 9 місяців тому

    f-string work like a string literal in JavaScript

  • @ubaidtv2559
    @ubaidtv2559 Рік тому

    Sir artificial intelligence course bhi launch kar dem

  • @tonykrafton2205
    @tonykrafton2205 Рік тому

    Present ! Day 28

  • @apekshagupta2307
    @apekshagupta2307 8 місяців тому

    8:00
    string ko as it is show karne ke liye string se pehele wale f ko bhi to hata sakte hai na?

  • @Krishna40457
    @Krishna40457 Рік тому +1

    #Day28

  • @soumyadipmajumder902
    @soumyadipmajumder902 Рік тому +2

    In this video 8:20 time we can also delete the 'f' outside the double quotes to show calibrates with the parameter name, like
    print("My name is {name} and I am from {country}")

    • @krishgaikwad6108
      @krishgaikwad6108 Рік тому +1

      yup, thats what i thought too !!!

    • @mathocity8337
      @mathocity8337 Рік тому

      Beside printing {something}, what if you also want to print a variable in the same string?
      i.e.
      name = "Random"
      print (f"My name is {name} and I'm from {{country}}")
      In this case, you just can't remove f" " cuz you want to print {name} too.

  • @user-lg9sy7cr4t
    @user-lg9sy7cr4t Місяць тому +1

    present sir

  • @Trickyonline-tp9oe
    @Trickyonline-tp9oe Рік тому

    Day 28 done!

  • @harsh_-gi2nw
    @harsh_-gi2nw Рік тому +1

    Present sir
    Day 28 of 100 days of code

  • @anonymous____________________4

    Pranam bhrata 🙏 apka bahutt baht dhanyawad ❤️😌🙏😇🧡💛😇

  • @vjournalbytej9832
    @vjournalbytej9832 8 місяців тому

    Present Sir 🤚

  • @JoyBoy_013
    @JoyBoy_013 Рік тому

    Great Harry bhai

  • @adityapradhan8474
    @adityapradhan8474 Рік тому

    Majja aa raha hai harry bhai
    Python se to pyaar sa hogya hai

  • @biswajeet9826
    @biswajeet9826 2 місяці тому

    Thanks a lot Sir!!

  • @rajghitode
    @rajghitode Рік тому

    Apple macbook m1 abhi lena chahiye kya pls reply

  • @rockway7963
    @rockway7963 Рік тому

    print(f"{2 * 30}")
    Guys iss code m No. Ko int() define nhi kiya code m to ,python isse as a string smghega ,lekin value kaise mil ja rha h 60 jbki wo isse as a string consider kar rha h?

    • @rockway7963
      @rockway7963 Рік тому

      Kya f string m hmme int batane ki jaroorat nhi h ,(Double cot) string m python ko show karna k liye?

  • @eashovon
    @eashovon Рік тому

    Present from Bangladesh Brother.....#day28 Done

  • @sunilkumargupta6629
    @sunilkumargupta6629 Рік тому +1

    Day #28

  • @makripon
    @makripon Рік тому

    Why need to print example of f-string inside f-string. simply remove f of begining. I printed this - This is how to create F-String: write variable name inside curly bracket like {variable-name} and put a f at begining. For example, f"my name is {firstName} {lastName}" using this - print('This is how to create F-String: write variable name inside curly bracket like {variable-name} and put a f at begining. For example, f"my name is {firstName} {lastName}"' )

  • @niteshch9166
    @niteshch9166 Рік тому

    Present Harry Sir!

  • @sahityadwivedi216
    @sahityadwivedi216 Рік тому +4

    making Kbc execise was fun

  • @sachinkumarsharma6483
    @sachinkumarsharma6483 Рік тому

    Day_28 Present Sir

  • @__Atif_7190
    @__Atif_7190 Рік тому

    I create it Because for solving doubts

  • @deadlygamer4692
    @deadlygamer4692 9 місяців тому +1

    print("Welcome ladies and gentlemen to Kaun Banega Crorepati
    first question for 7 crore on your computer screen is ")
    q = ["How many colours are there in a rainbow?","(a)2 (b)5 (c)7 (d)8"]
    print(q)
    a = str(input("Enter the correct answer = "))
    ans1 = "c"
    ans2 = "7"
    ans3 = "seven"
    ans4 = "Seven"
    ans5 = "C"
    if (a== ans1 or a==ans2 or a==ans3 or a==ans4 or a==ans5) :
    print("Congratulations!,You win 7 crore.")
    else :
    print("Sorry answer is wrong.")

  • @rahuljoshi2360
    @rahuljoshi2360 12 днів тому

    Replit ki new policy ki wjah se or repls create nhi ho rhi :(

  • @user-mq3mf3zb2y
    @user-mq3mf3zb2y Рік тому

    In f_string there is not given the value of {Name,Country}

  • @__ayu
    @__ayu Рік тому +1

    #DAY28 COMPLETED
    THANK YOU #CodeWithHarry

  • @Normalgamer1711
    @Normalgamer1711 Рік тому

    Bhaiya web 3.0 ka full stack developer course lao please ya iske bare me ek acha sa roadmap video banado....

  • @thor4276
    @thor4276 Рік тому +1

    Kya baat hai guru jii

  • @Fun-xz5zd
    @Fun-xz5zd Рік тому +1

    I'm present.

  • @NEERAJ-dw9bt
    @NEERAJ-dw9bt 7 місяців тому

    Present sir 🤚

  • @volcano_ff
    @volcano_ff 2 місяці тому

    First line ka {0} dusre line mai kaise kiya please bataua

  • @geekytutorials5745
    @geekytutorials5745 5 місяців тому

    Thanks bhaiya ❤

  • @yatindrapabbati6878
    @yatindrapabbati6878 Рік тому

    Day28-PRESENT SIR!

  • @forexspectrum4799
    @forexspectrum4799 Рік тому

    superb brother

  • @Karna-Sinjali
    @Karna-Sinjali Рік тому +1

    Question = ("What is the capital city of Nepal")
    O1 = ("Kathmandu")
    O2= ("Pokhera")
    O3 = ("Jhapa")
    O4 = ("Nepaljung")
    option = [O1, O2, O3, O4,]
    print(option)
    money = 000
    add = money + 1000
    answer = O1
    if answer in option:
    print("yes,You won the NRs 1000")
    print("Your total money is :", add)
    else:
    print("No, You lose money")

    • @FaceSenseAustralia
      @FaceSenseAustralia Рік тому +1

      Practice Questions for this exercise:
      1. Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old.
      2. Write a program that calculates the area of a rectangle. Prompt the user for the length and width, then display the result using an f-string.
      3. Develop a simple currency converter program. Ask the user for an amount in USD and convert it to euros using a fixed conversion rate. Display the result using an f-string.

    • @Hillo372
      @Hillo372 8 місяців тому

      @@FaceSenseAustralia !✨🤩

  • @mariamhasan3733
    @mariamhasan3733 Рік тому

    Day #28 done

  • @AnuragSingh-yh9ew
    @AnuragSingh-yh9ew Рік тому

    Present Sir, Done!!

  • @rishiraj2548
    @rishiraj2548 Рік тому

    Happy festive season

  • @ekanshsharma6256
    @ekanshsharma6256 11 місяців тому +1

    8:16 we can simply remove f from the starting🤣😂