Presentation is loading. Please wait.

Presentation is loading. Please wait.

GCSE Computing.

Similar presentations


Presentation on theme: "GCSE Computing."— Presentation transcript:

1 GCSE Computing

2 Variables name = “Larry” print(“Hi ”, name)
input(“\n\nPress a key to continue”) Variable name – contain only numbers, letters and underscores. Cannot start with a number. name = input(“Hi. What’s your name? “)

3 String methods quote = “I think there is a world market for maybe five computers. IBM Chief 1943” print(“Original quote:”) print (quote) print(quote.upper()) quote.lower() swapcase capitalize title strip – removes all tabs, spaces and new lines replace(old, new [,max]) replaces a word replace(“five”, “a billion”)

4 Trust fund buddy program
Car = input(“Car cost: “) Etc. Repeat for four other items Total = car + etc (not adding, concatenating strings) print(“/n Grand total: “, total) Car = int(input(“car cost: “)) Or car = int(car) on second line Float (x) = 10.0 Int(x) = 10 Str(x) = ‘10’

5 Augmented assignment operators
Food = food * same as Food *= 52 x/= x=x/5 X-= x=x etc.

6 Python – 2nd Tutorial “Variables”
Apply skills Write a program in script mode to enter name, age (in years) and weight. The program must then output (print) the name five times, the persons age in seconds (work out a formula) and their weight on the moon (divide by 6) and weight on the sun (multiply by 27.1) Make sure that you add a line of code to delay the program until the user presses a key.


Download ppt "GCSE Computing."

Similar presentations


Ads by Google