f string in python

technical talkiess
0

 import random


# platform modules gives you main dir and path name

import platform

import statistics


rand = random.randint(0,3)


rand = random.random() * 100


lit = ['vishal','kaka','mama','dada','test','gfddfdf']

print(random.choice(lit))


# gives directory name of the current file


dir_name = dir(platform)

print(dir_name)


# gives processsor information

print(platform.processor())



import requests


x = requests.get('https://w3schools.com/python/demopage.htm')


print(x.text)



url = 'https://www.w3schools.com/python/demopage.php'

myobj = {'somekey': 'somevalue'}


x = requests.post(url, json = myobj)


print(x.text)




name = "vishal"

age = 23


# this is the one way to declare the variable in the python

# a = "This is the %s %s"% (name ,age)


# this is another way to bind the variable in the given string

# a = "This is {} {}"

# c = a.format(name,age)


# isme readablity kam hoti hai aur program me agar jada variable hue to manage karna hard hota hai

f_string = f"This is the {name } and My age is :- {age }"

print(f_string)
Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)