Skip to main content

Concatenate

 

Concatenate 



All it really means is combine text (remember, text is called a string) and variables together into single sentences

EXAMPLE: 
myName = input("What's your name? ")
myLunch = input("What are you having for lunch? ")
print(myName, "is going to be chowing down on", myLunch, "very soon!")





















Comments

Popular posts from this blog

Web Scraping

 Web Scraping Some websites don't have lovely APIs for us to interface with. If we want data from these pages, we have to use a tecnique called scraping. This means downloading the whole webpage and poking at it until we can find the information we want. You're going to use scraping to get the top ten restaurants near you. Get started 👉 Go to a website like Yelp and search for the top 10 reastaurants in your location. Copy the URL.   url = "https://www.yelp.co.uk/search?find_desc=Restaurants&find_loc=San+Francisco%2C+CA%2C+United+States"   Import libraries 👉 Import your libraries. Beautiful soup is a specialist library for extracting the contents of HTML and helping us parse them. Run the Repl once your imports are sorted because we want the Beautiful Soup library to be installed (it'll run quicker this way). import requests from bs4 import BeautifulSoup url = "https://www.yelp.co.uk/search?find_desc=Restaurants&find_loc=San+Francisco%2C+CA%2C+Unite...

String Manipulation

   String Manipulation Does this code look familiar from the insult generator project? name = input("What's your name? ") if name == "David" or name == "david":   print("Hello Baldy!") else:    print("What a beautiful head of hair!") Right now, if the user writes "DAVID" or "david", the if statement works correctly. However, "DaVID" does not give the correct output. To the computer, " david", "dAviD", and "david" are completely different. To simplify what the user typed in, we can add these functions to the end of the name of the variable: .lower() = all letters are lower case .upper() = all letters are upper case .title() = capital letter for the first letter of every word .capitalize() = capital letter for the first letter of only the first word    

Authentication

 Authentication Efficient code often has the drawback of being very hard to understand at first. It's often very dense, with lots of things happening on a single line of code. That's why teachers often teach what could be described as 'the long way round' when designing lessons on new topics. With all that in mind, don't be mad at us when we say that there is an easier way to create a login system than by using sessions. You've spent the past few days getting a really thorough grounding in what's going on behind the scenes, which was the whole point. No, really. We promise. Replit Authentication Here at Replit, we know that you will probably be using authentication a lot. So we've baked in the feature for you. 👉 Run your code, then head over to your left hand files pane and scroll until you see authentication. Then, erm, turn it on. That's it. Now you will see that your repl uses the default Replit login page. I can also access a bunch of informatio...